[mw-devel] MW3 r1108 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Sun Nov 22 16:28:37 GMT 2009


Author: welshbyte
Date: 2009-11-22 16:28:37 +0000 (Sun, 22 Nov 2009)
New Revision: 1108

Modified:
   trunk/src/files.c
   trunk/src/files.h
   trunk/src/proto.h
Log:
- Pass an appropriate mode to open(2) for when openuserfile() is called with O_CREAT
- s/mode/flags/ in openuserfile declarations to avoid confusion


Modified: trunk/src/files.c
===================================================================
--- trunk/src/files.c	2009-11-22 15:12:31 UTC (rev 1107)
+++ trunk/src/files.c	2009-11-22 16:28:37 UTC (rev 1108)
@@ -28,7 +28,7 @@
 int openuserfile(int flags)
 {
 	int x;
-	x=open(USERFILE,flags);
+	x=open(USERFILE,flags,S_IRUSR|S_IWUSR|S_IRGRP);
 	if (x>=0) return x;
 
 	if (errno != ENOENT || createuserfile())
@@ -37,7 +37,7 @@
 		exit(-1);
 	}
 
-	x=open(USERFILE,flags);
+	x=open(USERFILE,flags,S_IRUSR|S_IWUSR|S_IRGRP);
 	if (x>=0) return x;
 
 	perror("Open User File After Create");

Modified: trunk/src/files.h
===================================================================
--- trunk/src/files.h	2009-11-22 15:12:31 UTC (rev 1107)
+++ trunk/src/files.h	2009-11-22 16:28:37 UTC (rev 1108)
@@ -10,7 +10,7 @@
 
 int openfolderfile(int mode);
 int nofolders(void);
-int openuserfile(int mode);
+int openuserfile(int flags);
 int is_old(struct person *usr, const char *name, int32_t *userposn);
 void write_usr(struct person *record, int32_t *userposn);
 int openwhofile(int mode);

Modified: trunk/src/proto.h
===================================================================
--- trunk/src/proto.h	2009-11-22 15:12:31 UTC (rev 1107)
+++ trunk/src/proto.h	2009-11-22 16:28:37 UTC (rev 1108)
@@ -159,7 +159,7 @@
 /* files.c (see also files.h) */
 int openfolderfile(int mode);
 int nofolders(void);
-int openuserfile(int mode);
+int openuserfile(int flags);
 void write_usr(struct person *record, int32_t *userposn);
 int openwhofile(int mode);
 void who_add(int pid, int32_t posn);




More information about the mw-devel mailing list