summaryrefslogtreecommitdiff
path: root/devel/cvs/patches/patch-af
blob: d6ab5e63ceb28a419de481b675ac038ac02447fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$NetBSD: patch-af,v 1.7 2003/07/12 09:19:18 wiz Exp $

--- src/update.c.orig	Sat Apr 26 21:51:11 2003
+++ src/update.c
@@ -1336,11 +1336,18 @@ VERS: ", 0);
 		    xchmod (finfo->file, 1);
 		else
 		{
+		    mode_t oumask, writeaccess;
+
 		    /* We know that we are the server here, so
                        although xchmod checks umask, we don't bother.  */
-		    mode |= (((mode & S_IRUSR) ? S_IWUSR : 0)
+		    /* Not bothering with the umask makes the files
+		       mode 0777 on old clients, though. -chb */
+		    oumask = umask(0);
+		    (void) umask(oumask);
+		    writeaccess = (((mode & S_IRUSR) ? S_IWUSR : 0)
 			     | ((mode & S_IRGRP) ? S_IWGRP : 0)
 			     | ((mode & S_IROTH) ? S_IWOTH : 0));
+		    mode |= (~oumask) & writeaccess;
 		}
 	    }