Do always create ktrace.out with mode 0600, to prevent it from

accidentally compromising information confidential to the user running
ktrace.
This commit is contained in:
Joerg Wunsch 1996-06-30 09:40:44 +00:00
parent c683ac7c95
commit 4ac5adf036
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16844

View File

@ -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 <sys/param.h>
@ -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) {