From 4ac5adf036a78e6761d6d3067e6d41ec5fde5a95 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 30 Jun 1996 09:40:44 +0000 Subject: [PATCH] Do always create ktrace.out with mode 0600, to prevent it from accidentally compromising information confidential to the user running ktrace. --- usr.bin/ktrace/ktrace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c index 38577f36838e..8a9b08ab3919 100644 --- a/usr.bin/ktrace/ktrace.c +++ b/usr.bin/ktrace/ktrace.c @@ -42,7 +42,7 @@ static char copyright[] = static char sccsid[] = "@(#)ktrace.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: ktrace.c,v 1.4 1996/06/19 09:56:29 jraynard Exp $"; #endif /* not lint */ #include @@ -71,6 +71,7 @@ main(argc, argv) enum { NOTSET, CLEAR, CLEARALL } clear; int append, ch, fd, inherit, ops, pid, pidset, trpoints; char *tracefile; + mode_t omask; clear = NOTSET; append = ops = pidset = inherit = 0; @@ -138,9 +139,11 @@ main(argc, argv) exit(0); } + omask = umask(S_IRWXG|S_IRWXO); if ((fd = open(tracefile, O_CREAT | O_WRONLY | (append ? 0 : O_TRUNC), DEFFILEMODE)) < 0) err(1, tracefile); + (void)umask(omask); (void)close(fd); if (*argv) {