From 2d0db2a357084a44a325cae430d05673e948625c Mon Sep 17 00:00:00 2001 From: beck <> Date: Tue, 24 Jan 2017 12:30:35 +0000 Subject: fix mode on open() and ftruncate(), noticed by bcook@ --- src/usr.sbin/ocspcheck/ocspcheck.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/usr.sbin/ocspcheck/ocspcheck.c b/src/usr.sbin/ocspcheck/ocspcheck.c index 8ce1008dbe..87d8b747fb 100644 --- a/src/usr.sbin/ocspcheck/ocspcheck.c +++ b/src/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-55-g6feb