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.7 2008/01/30 05:43:55 obache Exp $
--- db.c.orig 2007-12-29 07:45:33.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";
@@ -892,9 +893,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);
|