version 1.4, 1997/01/15 23:42:40 |
version 1.5, 1997/06/18 09:44:09 |
|
|
} |
} |
|
|
omask = umask(S_IRWXG|S_IRWXO); |
omask = umask(S_IRWXG|S_IRWXO); |
if ((fd = open(tracefile, O_CREAT | O_WRONLY | (append ? 0 : O_TRUNC), |
if (append) { |
DEFFILEMODE)) < 0) |
if ((fd = open(tracefile, O_CREAT | O_WRONLY, DEFFILEMODE)) < 0) |
err(1, tracefile); |
err(1, tracefile); |
|
if (fstat(fd, &sb) != 0 || sb.st_uid != getuid()) |
|
errx(1, "Refuse to append to %s: not owned by you.", |
|
tracefile); |
|
} else { |
|
if (unlink(tracefile) == -1 && errno != ENOENT) |
|
err(1, "unlink %s", tracefile); |
|
if ((fd = open(tracefile, O_CREAT | O_EXCL | O_WRONLY, |
|
DEFFILEMODE)) < 0) |
|
err(1, tracefile); |
|
} |
(void)umask(omask); |
(void)umask(omask); |
(void)close(fd); |
(void)close(fd); |
|
|
|
|
|
|
void |
void |
no_ktrace(sig) |
no_ktrace(sig) |
int sig; |
int sig; |
{ |
{ |
(void)fprintf(stderr, |
(void)fprintf(stderr, |
"error:\tktrace() system call not supported in the running kernel\n\tre-compile kernel with 'options KTRACE'\n"); |
"error:\tktrace() system call not supported in the running kernel\n\tre-compile kernel with 'options KTRACE'\n"); |
exit(1); |
exit(1); |
} |
} |