summaryrefslogtreecommitdiff
path: root/biology/nut/patches/patch-ab
blob: 4cac755af23d4cf49f83ee5ae220504fd00f17da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$NetBSD: patch-ab,v 1.8 2010/09/19 07:52:19 obache Exp $

--- db.c.orig	2010-08-20 04:04:35.000000000 +0000
+++ db.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <ctype.h>
+#include <errno.h>
  
 #ifndef NUTDIR
 char nutdir1[]=".nutdb";
@@ -982,9 +983,22 @@ strcpy(subuser,sub);
  sprintf(versionfile,"%s/%s/%s","NUTDB",subuser,versionfile1);
 #else
 sprintf(nutdir,"%s/%s",getenv("HOME"),nutdir1);
-mkdir (nutdir, 0700 );
+if (mkdir(nutdir, S_IRWXU|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) != 0) {
+    if (errno != EEXIST) {
+	printf("Cannot create %s: %s\n", nutdir,
+	       strerror(errno));
+	exit(1);
+    }
+}
 sprintf(nutdirsubuser,"%s/%s/%s",getenv("HOME"),nutdir1,subuser);
 mkdir (nutdirsubuser, 0700 );
+if (mkdir(nutdirsubuser, S_IRWXU|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) != 0) {
+    if (errno != EEXIST) {
+	printf("Cannot create %s: %s\n", nutdirsubuser,
+	       strerror(errno));
+	exit(1);
+    }
+}
 sprintf(USDAjoined,"%s/%s",FOODDIR,USDAjoined1);
 sprintf(globalFOOD,"%s/%s",FOODDIR,globalFOOD1);
 sprintf(globalNUT,"%s/%s",FOODDIR,globalNUT1);