From: Peter Pentchev Date: Sun, 22 Aug 2021 11:46:21 +0000 (+0300) Subject: Add a read error detection fix to the cppcheck patch. X-Git-Tag: archive/raspbian/1.2.1+ds1-1+rpi1~1^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d92902a3490584ef0c458880ee3b4040d1842289;p=zchunk.git Add a read error detection fix to the cppcheck patch. --- diff --git a/debian/patches/cppcheck.patch b/debian/patches/cppcheck.patch index f093eb7..8778dab 100644 --- a/debian/patches/cppcheck.patch +++ b/debian/patches/cppcheck.patch @@ -26,3 +26,20 @@ Last-Update: 2021-08-22 comp->cctx = ZSTD_createCCtx(); #ifndef OLD_ZSTD +--- a/src/lib/io.c ++++ b/src/lib/io.c +@@ -115,11 +115,13 @@ + char *data = zmalloc(BUF_SIZE); + + while((read_count = read(zck->temp_fd, data, BUF_SIZE)) > 0) { +- if(read_count == -1 || !write_data(zck, zck->fd, data, read_count)) { ++ if(!write_data(zck, zck->fd, data, read_count)) { + free(data); + return false; + } + } + free(data); ++ if(read_count == -1) ++ return false; + return true; + }