walters / rpms / nfs-utils

Forked from rpms/nfs-utils 6 years ago
Clone
c0c131b
diff -up nfs-utils-1.1.1/support/nfs/xio.c.save nfs-utils-1.1.1/support/nfs/xio.c
c0c131b
--- nfs-utils-1.1.1/support/nfs/xio.c.save	2007-10-18 23:07:28.000000000 -0400
c0c131b
+++ nfs-utils-1.1.1/support/nfs/xio.c	2008-01-05 08:27:35.000000000 -0500
c0c131b
@@ -54,13 +54,19 @@ xflock(char *fname, char *type)
1702f2c
 {
1702f2c
 	struct sigaction sa, oldsa;
1702f2c
 	int		readonly = !strcmp(type, "r");
1702f2c
+	mode_t  mode = (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
1702f2c
 	struct flock	fl = { readonly? F_RDLCK : F_WRLCK, SEEK_SET, 0, 0, 0 };
1702f2c
 	int		fd;
1702f2c
 
c0c131b
-	if ((fd = open(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT), 0644)) < 0) {
c0c131b
+	if (readonly)
1702f2c
+		fd = open(fname, O_RDONLY);
1702f2c
+	else
1702f2c
+		fd = open(fname, (O_RDWR|O_CREAT), mode);
1702f2c
+	if (fd < 0) {
c0c131b
 		xlog(L_WARNING, "could not open %s for locking", fname);
1702f2c
 		return -1;
1702f2c
 	}
1702f2c
+
1702f2c
 	sa.sa_handler = doalarm;
1702f2c
 	sa.sa_flags = 0;
1702f2c
 	sigemptyset(&sa.sa_mask);