summaryrefslogtreecommitdiff
path: root/devel/cvs/patches/patch-af
blob: 6bef6a0fec365b33336822ba5c7a92f7f5824e70 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$NetBSD: patch-af,v 1.4 2000/10/21 19:29:06 wiz Exp $

--- src/update.c.orig	Wed Jul 26 21:29:01 2000
+++ src/update.c
@@ -1374,11 +1374,18 @@
 		    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;
 		}
 	    }
 
@@ -2678,7 +2685,7 @@
 	    else
 	    {
 		/* If the size of `ftype' changes, fix the sscanf call also */
-		char ftype[16];
+		char ftype[16+1];
 		if (sscanf (n->data, "%16s %lu", ftype,
 			    &dev_long) < 2)
 		    error (1, 0, "%s:%s has bad `special' newphrase %s",
@@ -2756,7 +2763,7 @@
 	    else
 	    {
 		/* If the size of `ftype' changes, fix the sscanf call also */
-		char ftype[16];
+		char ftype[16+1];
 		if (sscanf (n->data, "%16s %lu", ftype,
 			    &dev_long) < 2)
 		    error (1, 0, "%s:%s has bad `special' newphrase %s",