diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2017-01-24 12:30:36 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2017-01-24 12:30:36 +0000 |
commit | b5b04dfdc145f46230f13306641446ba0d02f48e (patch) | |
tree | 4521ec924810f0480c8358907f8c33365451ceed | |
parent | 6637334fb5d6bf619179994d657a98af71634362 (diff) |
fix mode on open() and ftruncate(), noticed by
bcook@
-rw-r--r-- | usr.sbin/ocspcheck/ocspcheck.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ocspcheck/ocspcheck.c b/usr.sbin/ocspcheck/ocspcheck.c index 8ce1008dbef..87d8b747fba 100644 --- a/usr.sbin/ocspcheck/ocspcheck.c +++ b/usr.sbin/ocspcheck/ocspcheck.c @@ -16,6 +16,7 @@ #include <arpa/inet.h> #include <sys/socket.h> +#include <sys/stat.h> #include <err.h> #include <fcntl.h> @@ -542,7 +543,8 @@ main (int argc, char **argv) if (strcmp(outfile, "-") == 0) staplefd = STDOUT_FILENO; else - staplefd = open(outfile, O_WRONLY|O_CREAT); + staplefd = open(outfile, O_WRONLY|O_CREAT, + S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH); if (staplefd < 0) err(EXIT_FAILURE, "Unable to open output file %s", outfile); @@ -611,7 +613,7 @@ main (int argc, char **argv) * write out the DER format response to the staplefd */ if (staplefd >= 0) { - ftruncate(staplefd, 0); + (void) ftruncate(staplefd, 0); w = 0 ; written = 0; while (written < hget->bodypartsz) { |