diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-03-08 20:52:37 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-03-08 20:52:37 +0000 |
commit | 83eca1302d993efc79b525aa8958bbd400fb5eaf (patch) | |
tree | c9a9cd888eb49e12e5ae443f546b3e6ddd453e56 | |
parent | f180fa31bef240be9e356681d7f12aa11cec5f8b (diff) |
Set umask (and cvs_umask) to system's umask in local and client mode.
Also zap umask(0);umask(mask); calls, we have cvs_umask for this.
ok joris
-rw-r--r-- | usr.bin/cvs/client.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.c | 7 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 8 |
3 files changed, 12 insertions, 17 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index a2cdcc74fba..943722e7af1 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.108 2008/02/29 21:43:57 joris Exp $ */ +/* $OpenBSD: client.c,v 1.109 2008/03/08 20:52:36 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -676,7 +676,7 @@ cvs_client_updated(char *data) { int fd; time_t now; - mode_t fmode, mask; + mode_t fmode; size_t flen; CVSENTRIES *ent; struct cvs_ent *e; @@ -714,9 +714,7 @@ cvs_client_updated(char *data) cvs_strtomode(mode, &fmode); xfree(mode); - mask = umask(0); - umask(mask); - fmode &= ~mask; + fmode &= ~cvs_umask; time(&now); asctime_r(gmtime(&now), timebuf); @@ -778,7 +776,7 @@ cvs_client_merged(char *data) { int fd; time_t now; - mode_t fmode, mask; + mode_t fmode; size_t flen; CVSENTRIES *ent; const char *errstr; @@ -816,9 +814,7 @@ cvs_client_merged(char *data) cvs_strtomode(mode, &fmode); xfree(mode); - mask = umask(0); - umask(mask); - fmode &= ~mask; + fmode &= ~cvs_umask; time(&now); asctime_r(gmtime(&now), timebuf); diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index c403c21c915..c5c4760896c 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.c,v 1.143 2008/02/26 21:23:00 joris Exp $ */ +/* $OpenBSD: cvs.c,v 1.144 2008/03/08 20:52:36 tobias Exp $ */ /* * Copyright (c) 2006, 2007 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -241,6 +241,9 @@ main(int argc, char **argv) return (0); } + cvs_umask = umask(0); + umask(cvs_umask); + if ((current_cvsroot = cvsroot_get(".")) == NULL) { cvs_log(LP_ERR, "No CVSROOT specified! Please use the '-d' option"); @@ -274,8 +277,6 @@ main(int argc, char **argv) cvs_parse_modules(); } - umask(cvs_umask); - cmdp->cmd(cmd_argc, cmd_argv); cvs_cleanup(); diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index afbf38e4e7e..968e2b373a4 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.258 2008/03/08 20:26:34 joris Exp $ */ +/* $OpenBSD: rcs.c,v 1.259 2008/03/08 20:52:36 tobias Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -241,7 +241,7 @@ RCSFILE * rcs_open(const char *path, int fd, int flags, ...) { int mode; - mode_t fmode, mask; + mode_t fmode; RCSFILE *rfp; va_list vap; struct rcs_delta *rdp; @@ -257,9 +257,7 @@ rcs_open(const char *path, int fd, int flags, ...) fmode = (mode_t)mode; } - mask = umask(0); - umask(mask); - fmode &= ~mask; + fmode &= ~cvs_umask; rfp = xcalloc(1, sizeof(*rfp)); |