From b5b04dfdc145f46230f13306641446ba0d02f48e Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Tue, 24 Jan 2017 12:30:36 +0000 Subject: fix mode on open() and ftruncate(), noticed by bcook@ --- usr.sbin/ocspcheck/ocspcheck.c | 6 ++++-- 1 file 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 #include +#include #include #include @@ -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) { -- cgit v1.2.3