summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-10-15 10:17:32 +0000
committerderaadt <deraadt@openbsd.org>1996-10-15 10:17:32 +0000
commita83c53b6a88028d60953cd317b27deb1a59f35c5 (patch)
tree4651a0cee639b1275937750da5ae5803d789aba1
parentgcc -Wall happy (diff)
downloadwireguard-openbsd-a83c53b6a88028d60953cd317b27deb1a59f35c5.tar.xz
wireguard-openbsd-a83c53b6a88028d60953cd317b27deb1a59f35c5.zip
umask for writes; from joerg@freebsd.org
-rw-r--r--sbin/savecore/savecore.c6
-rw-r--r--sbin/savecore/savecore_old.c8
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 *