From cf4ae693c5e67b33343fb24f7fdcf05fd1fe7f8e Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Wed, 1 Mar 2017 06:20:16 +1300 Subject: [PATCH] squidclient: Fix missing error handling on PUT Detected by Coverity Scan. Issue 1364710 --- tools/squidclient/squidclient.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/squidclient/squidclient.cc b/tools/squidclient/squidclient.cc index 1b17e12c32..cfc2656899 100644 --- a/tools/squidclient/squidclient.cc +++ b/tools/squidclient/squidclient.cc @@ -569,8 +569,11 @@ main(int argc, char *argv[]) if (put_file) { debugVerbose(1, "Sending HTTP request payload ..."); int x; - lseek(put_fd, 0, SEEK_SET); - while ((x = read(put_fd, buf, sizeof(buf))) > 0) { + if ((x = lseek(put_fd, 0, SEEK_SET)) < 0) { + int xerrno = errno; + std::cerr << "ERROR: lseek: " << xstrerr(xerrno) << std::endl; + + } else while ((x = read(put_fd, buf, sizeof(buf))) > 0) { x = Transport::Write(buf, x); -- 2.47.2