From: Amos Jeffries Date: Tue, 28 Feb 2017 17:20:16 +0000 (+1300) Subject: squidclient: Fix missing error handling on PUT X-Git-Tag: M-staged-PR71~238 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf4ae693c5e67b33343fb24f7fdcf05fd1fe7f8e;p=thirdparty%2Fsquid.git squidclient: Fix missing error handling on PUT Detected by Coverity Scan. Issue 1364710 --- 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);