diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2006-03-14 19:32:03 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2006-03-14 19:32:03 +0000 |
| commit | 9e92c8d4866f5700c1b233ef7af8875a4a03f802 (patch) | |
| tree | 0ccbbd29c86267b5ae6eae220b5bf74fe319b429 | |
| parent | 945a519a23369e9ab75639f2c58f4ca6aa56d07f (diff) | |
Notes
| -rw-r--r-- | usr.bin/ktrace/ktrace.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c index 4b8379614e64..84f10ee44723 100644 --- a/usr.bin/ktrace/ktrace.c +++ b/usr.bin/ktrace/ktrace.c @@ -145,11 +145,14 @@ main(int argc, char *argv[]) omask = umask(S_IRWXG|S_IRWXO); if (append) { - if ((fd = open(tracefile, O_CREAT | O_WRONLY, DEFFILEMODE)) < 0) + if ((fd = open(tracefile, O_CREAT | O_WRONLY | O_NONBLOCK, + DEFFILEMODE)) < 0) err(1, "%s", tracefile); if (fstat(fd, &sb) != 0 || sb.st_uid != getuid()) errx(1, "refuse to append to %s not owned by you", tracefile); + if (!(S_ISREG(sb.st_mode))) + errx(1, "%s not regular file", tracefile); } else { if (unlink(tracefile) == -1 && errno != ENOENT) err(1, "unlink %s", tracefile); |
