$NetBSD: patch-af,v 1.2 2000/02/23 06:48:56 mycroft Exp $

--- src/update.c.orig	Thu Jun 25 10:56:50 1998
+++ src/update.c	Wed Feb 23 01:28:45 2000
@@ -1039,7 +1039,8 @@
 	    cvs_output (": Executing '", 0);
 	    run_print (stdout);
 	    cvs_output ("'\n", 0);
-	    (void) run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
+	    (void) run_exec (RUN_TTY, RUN_TTY, RUN_TTY,
+			     RUN_NORMAL | RUN_UNSETXID);
 	}
 	else if (ferror (fp))
 	    error (0, errno, "cannot read %s", CVSADM_UPROG);
@@ -1304,11 +1305,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;
 		}
 	    }