diff options
| author | beck <> | 2017-01-24 12:30:35 +0000 |
|---|---|---|
| committer | beck <> | 2017-01-24 12:30:35 +0000 |
| commit | b85077b463a8a7945a307dca02a1a372b16f4a9e (patch) | |
| tree | 614a3c250d22999bb1fecb62e35ef6db4ef2fab7 /src | |
| parent | 6a4e1e69b66e09064122e5dcf8abfe49b19bb03c (diff) | |
| download | openbsd-b85077b463a8a7945a307dca02a1a372b16f4a9e.tar.gz openbsd-b85077b463a8a7945a307dca02a1a372b16f4a9e.tar.bz2 openbsd-b85077b463a8a7945a307dca02a1a372b16f4a9e.zip | |
fix mode on open() and ftruncate(), noticed by
bcook@
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.sbin/ocspcheck/ocspcheck.c | 6 |
1 files 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 @@ | |||
| 16 | 16 | ||
| 17 | #include <arpa/inet.h> | 17 | #include <arpa/inet.h> |
| 18 | #include <sys/socket.h> | 18 | #include <sys/socket.h> |
| 19 | #include <sys/stat.h> | ||
| 19 | 20 | ||
| 20 | #include <err.h> | 21 | #include <err.h> |
| 21 | #include <fcntl.h> | 22 | #include <fcntl.h> |
| @@ -542,7 +543,8 @@ main (int argc, char **argv) | |||
| 542 | if (strcmp(outfile, "-") == 0) | 543 | if (strcmp(outfile, "-") == 0) |
| 543 | staplefd = STDOUT_FILENO; | 544 | staplefd = STDOUT_FILENO; |
| 544 | else | 545 | else |
| 545 | staplefd = open(outfile, O_WRONLY|O_CREAT); | 546 | staplefd = open(outfile, O_WRONLY|O_CREAT, |
| 547 | S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH); | ||
| 546 | if (staplefd < 0) | 548 | if (staplefd < 0) |
| 547 | err(EXIT_FAILURE, "Unable to open output file %s", | 549 | err(EXIT_FAILURE, "Unable to open output file %s", |
| 548 | outfile); | 550 | outfile); |
| @@ -611,7 +613,7 @@ main (int argc, char **argv) | |||
| 611 | * write out the DER format response to the staplefd | 613 | * write out the DER format response to the staplefd |
| 612 | */ | 614 | */ |
| 613 | if (staplefd >= 0) { | 615 | if (staplefd >= 0) { |
| 614 | ftruncate(staplefd, 0); | 616 | (void) ftruncate(staplefd, 0); |
| 615 | w = 0 ; | 617 | w = 0 ; |
| 616 | written = 0; | 618 | written = 0; |
| 617 | while (written < hget->bodypartsz) { | 619 | while (written < hget->bodypartsz) { |
