From 00da28bc3a07739175ba381dd144857e78835eea Mon Sep 17 00:00:00 2001 From: tb <> Date: Fri, 4 Sep 2020 04:17:46 +0000 Subject: Ignore ftruncate failure with errno == EAGAIN This makes piping the OCSP response to other programs with -o - work. input and r+ guenther --- src/usr.sbin/ocspcheck/ocspcheck.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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 @@ -/* $OpenBSD: ocspcheck.c,v 1.26 2020/01/23 03:53:39 tb Exp $ */ +/* $OpenBSD: ocspcheck.c,v 1.27 2020/09/04 04:17:46 tb Exp $ */ /* * Copyright (c) 2017 Bob Beck @@ -707,9 +707,12 @@ main(int argc, char **argv) * write out the DER format response to the staplefd */ if (staplefd >= 0) { - while (ftruncate(staplefd, 0) < 0) + while (ftruncate(staplefd, 0) < 0) { + if (errno == EINVAL) + break; if (errno != EINTR && errno != EAGAIN) err(1, "Write of OCSP response failed"); + } w = 0; written = 0; while (written < instaplesz) { -- cgit v1.2.3-55-g6feb