From d931777c06c73b2586632c603beec2156c9c73b2 Mon Sep 17 00:00:00 2001 From: bcook <> Date: Wed, 15 May 2019 13:44:18 +0000 Subject: check result of ftruncate() as we do write() below ok beck@ --- src/usr.sbin/ocspcheck/ocspcheck.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/usr.sbin/ocspcheck/ocspcheck.c b/src/usr.sbin/ocspcheck/ocspcheck.c index 551a8fa091..41700f91a0 100644 --- a/src/usr.sbin/ocspcheck/ocspcheck.c +++ b/src/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 @@ -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) { -- cgit v1.2.3-55-g6feb