[This patch fixes a long-standing bug in the client/server CVS. The patch looks right, although I haven't looked at it hard. Also needs a testcase (looks at the "modes" case in sanity.sh; it quite possibly is working around this bug already). -kingdon] To: bug-cvs@gnu.org Subject: Client side umask and pserver From: Steen Lumholt Date: 05 Jan 1998 15:10:58 +0100 In CVS 1.9.22 using pserver. CVS don't use the umask on the client side when creating files. I.e. when making a `cvs co' it is possible to get -rw-rw-rw- files, although umask is 022. The following patch solves the problem. *** client.c.orig Mon Jan 5 13:13:13 1998 --- client.c Mon Jan 5 13:00:41 1998 *************** change_mode (filename, mode_string) *** 223,228 **** --- 223,229 ---- char *p; mode_t mode = 0; + mode_t oumask; p = mode_string; while (*p != '\0') *************** change_mode (filename, mode_string) *** 275,280 **** --- 276,286 ---- if (*p == ',') ++p; } + + /* Respect the users umask. */ + oumask = umask (0); + (void) umask (oumask); + mode &= ~oumask; if (chmod (filename, mode) < 0) return errno;