summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <bcook@cvs.openbsd.org>2019-05-15 13:44:19 +0000
committerBrent Cook <bcook@cvs.openbsd.org>2019-05-15 13:44:19 +0000
commitbbb427df72997b3a13fe519ddc5db345005c3aba (patch)
tree9f56bff99ae587bd79e7c287456ada395589215d
parent45537f6b94632b2bb381a5b090f5665f7fa0b410 (diff)
check result of ftruncate() as we do write() below
ok beck@
-rw-r--r--usr.sbin/ocspcheck/ocspcheck.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ocspcheck/ocspcheck.c b/usr.sbin/ocspcheck/ocspcheck.c
index 551a8fa091f..41700f91a08 100644
--- a/usr.sbin/ocspcheck/ocspcheck.c
+++ b/usr.sbin/ocspcheck/ocspcheck.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ocspcheck.c,v 1.24 2017/12/01 14:42:23 visa Exp $ */
+/* $OpenBSD: ocspcheck.c,v 1.25 2019/05/15 13:44:18 bcook Exp $ */
/*
* Copyright (c) 2017 Bob Beck <beck@openbsd.org>
@@ -670,7 +670,9 @@ main(int argc, char **argv)
* write out the DER format response to the staplefd
*/
if (staplefd >= 0) {
- (void) ftruncate(staplefd, 0);
+ while (ftruncate(staplefd, 0) < 0)
+ if (errno != EINTR && errno != EAGAIN)
+ err(1, "Write of OCSP response failed");
w = 0;
written = 0;
while (written < instaplesz) {