Add a read error detection fix to the cppcheck patch.
authorPeter Pentchev <roam@debian.org>
Sun, 22 Aug 2021 11:46:21 +0000 (14:46 +0300)
committerPeter Pentchev <roam@debian.org>
Sun, 22 Aug 2021 11:46:21 +0000 (14:46 +0300)
debian/patches/cppcheck.patch

index f093eb7609897e73c54d2e3650b54f1b30fee0e9..8778dab40611894f116116a46853d01b1e5a5148 100644 (file)
@@ -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;
+ }