diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-10-15 10:17:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-10-15 10:17:35 +0000 |
commit | 5c0492969bf0ca9f49646b000fd072b74fb37d61 (patch) | |
tree | aef7716051b08b46e0ac3d06d62ffdb28cf9dbcf | |
parent | a45400417463c113cb3d0fccf173fc8ac9d132c1 (diff) |
umask for writes; from joerg@freebsd.org
-rw-r--r-- | sbin/savecore/savecore.c | 6 | ||||
-rw-r--r-- | sbin/savecore/savecore_old.c | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index afd8590b692..5b0567f998d 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: savecore.c,v 1.6 1996/08/20 04:22:40 deraadt Exp $ */ +/* $OpenBSD: savecore.c,v 1.7 1996/10/15 10:17:32 deraadt Exp $ */ /* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */ /*- @@ -357,6 +357,9 @@ save_core() register FILE *fp; register int bounds, ifd, nr, nw, ofd; char *rawp, path[MAXPATHLEN]; + mode_t um; + + um = umask(S_IRWXG|S_IRWXO); /* * Get the current number and update the bounds file. Do the update @@ -479,6 +482,7 @@ err2: syslog(LOG_WARNING, (void)fclose(fp); else (void)close(ofd); + (void)umask(um); } char * diff --git a/sbin/savecore/savecore_old.c b/sbin/savecore/savecore_old.c index fb86b29b36c..69d0c081206 100644 --- a/sbin/savecore/savecore_old.c +++ b/sbin/savecore/savecore_old.c @@ -1,4 +1,4 @@ -/* $OpenBSD: savecore_old.c,v 1.4 1996/06/23 14:32:40 deraadt Exp $ */ +/* $OpenBSD: savecore_old.c,v 1.5 1996/10/15 10:17:34 deraadt Exp $ */ /* $NetBSD: savecore_old.c,v 1.1.1.1 1996/03/16 10:25:11 leo Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94"; #else -static char rcsid[] = "$OpenBSD: savecore_old.c,v 1.4 1996/06/23 14:32:40 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: savecore_old.c,v 1.5 1996/10/15 10:17:34 deraadt Exp $"; #endif #endif /* not lint */ @@ -344,6 +344,9 @@ save_core() register FILE *fp; register int bounds, ifd, nr, nw, ofd; char *rawp, path[MAXPATHLEN]; + mode_t um; + + um = umask(S_IRWXG|S_IRWXO); /* * Get the current number and update the bounds file. Do the update @@ -460,6 +463,7 @@ err2: syslog(LOG_WARNING, (void)fclose(fp); else (void)close(ofd); + (void)umask(um); } char * |