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
|
$NetBSD: patch-ab,v 1.2 2003/07/12 12:23:13 wiz Exp $
--- db.c.orig Sun Jun 1 01:59:22 2003
+++ db.c
@@ -23,6 +23,7 @@
#include "meal.h"
#include "options.h"
#include "util.h"
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -729,7 +730,13 @@ void make_filenames(void)
sprintf(optionsfile,"%s/%s","NUTDB",optionsfile1);
#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: %s\n", getenv("HOME"), nutdir1,
+ strerror(errno));
+ exit(1);
+ }
+}
sprintf(USDAjoined,"%s/%s",FOODDIR,USDAjoined1);
sprintf(globalFOOD,"%s/%s",FOODDIR,globalFOOD1);
sprintf(globalNUT,"%s/%s",FOODDIR,globalNUT1);
|