]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
nfs-utils: specify a create mode with open(...O_CREAT) call in xflock
authorJeff Layton <jlayton@redhat.com>
Tue, 7 Aug 2007 12:01:08 +0000 (08:01 -0400)
committerNeil Brown <neilb@suse.de>
Thu, 9 Aug 2007 03:26:42 +0000 (13:26 +1000)
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.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
support/nfs/xio.c

index 221cce6ef2babdf35d96330e6399dd5d35679a3f..0453ca7c0ba305122ff5353267659336fd16f9ab 100644 (file)
@@ -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;
        }