summaryrefslogtreecommitdiff
path: root/src/usr.sbin/ocspcheck
diff options
context:
space:
mode:
authortb <>2020-09-04 04:17:46 +0000
committertb <>2020-09-04 04:17:46 +0000
commit00da28bc3a07739175ba381dd144857e78835eea (patch)
tree82d955e9ef4dbbe7c2ea962ba2e8c3bf8a3474b5 /src/usr.sbin/ocspcheck
parent64aeb329634d544ed92d444ec7731ad7f75d04f1 (diff)
downloadopenbsd-00da28bc3a07739175ba381dd144857e78835eea.tar.gz
openbsd-00da28bc3a07739175ba381dd144857e78835eea.tar.bz2
openbsd-00da28bc3a07739175ba381dd144857e78835eea.zip
Ignore ftruncate failure with errno == EAGAIN
This makes piping the OCSP response to other programs with -o - work. input and r+ guenther
Diffstat (limited to 'src/usr.sbin/ocspcheck')
-rw-r--r--src/usr.sbin/ocspcheck/ocspcheck.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/usr.sbin/ocspcheck/ocspcheck.c b/src/usr.sbin/ocspcheck/ocspcheck.c
index ea06c128c4..d9f7104bec 100644
--- a/src/usr.sbin/ocspcheck/ocspcheck.c
+++ b/src/usr.sbin/ocspcheck/ocspcheck.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocspcheck.c,v 1.26 2020/01/23 03:53:39 tb Exp $ */ 1/* $OpenBSD: ocspcheck.c,v 1.27 2020/09/04 04:17:46 tb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2017 Bob Beck <beck@openbsd.org> 4 * Copyright (c) 2017 Bob Beck <beck@openbsd.org>
@@ -707,9 +707,12 @@ main(int argc, char **argv)
707 * write out the DER format response to the staplefd 707 * write out the DER format response to the staplefd
708 */ 708 */
709 if (staplefd >= 0) { 709 if (staplefd >= 0) {
710 while (ftruncate(staplefd, 0) < 0) 710 while (ftruncate(staplefd, 0) < 0) {
711 if (errno == EINVAL)
712 break;
711 if (errno != EINTR && errno != EAGAIN) 713 if (errno != EINTR && errno != EAGAIN)
712 err(1, "Write of OCSP response failed"); 714 err(1, "Write of OCSP response failed");
715 }
713 w = 0; 716 w = 0;
714 written = 0; 717 written = 0;
715 while (written < instaplesz) { 718 while (written < instaplesz) {