Skip to contentSkip to conversation

nfs-utils: specify a create mode with open(...O_CREAT) call in xflock

PATCH New Jeff Layton 1 participant 1 message Aug 6, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfs-utils: specify a create mode with open(...O_CREAT) call in xflock

The xflock function can create a file via open() with O_CREAT, but does not specify the create mode when it does so. I think 0644 should be appropriate given the current usage of this function.

support/nfs/xio.c +1 -1
index 221cce6..0453ca7 100644
@@ -57,7 +57,7 @@ xflock(char *fname, char *type)
 	struct flock	fl = { readonly? F_RDLCK : F_WRLCK, SEEK_SET, 0, 0, 0 };
 	int		fd;
 
-	if ((fd = open(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT))) < 0) {
+	if ((fd = open(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT), 0644)) < 0) {
 		xlog(L_WARNING, "could not open %s for locking", fname);
 		return -1;
 	}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs