Blame SOURCES/file-5.33-fix-compression.patch

0e5351
diff --git a/src/compress.c b/src/compress.c
0e5351
index cb11303..5677412 100644
0e5351
--- a/src/compress.c
0e5351
+++ b/src/compress.c
0e5351
@@ -723,25 +723,24 @@ uncompressbuf(int fd, size_t bytes_max, size_t method, const unsigned char *old,
0e5351
 		rv = OKDATA;
0e5351
 		if ((r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0)) > 0)
0e5351
 			break;
0e5351
-		DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
0e5351
-		    r != -1 ? strerror(errno) : "no data");
0e5351
-
0e5351
-		rv = ERRDATA;
0e5351
-		if (r == 0 &&
0e5351
-		    (r = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0)
0e5351
-		{
0e5351
+		if (r < 0) {
0e5351
+			rv = ERRDATA;
0e5351
+			DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
0e5351
+				strerror(errno));
0e5351
+			goto err;
0e5351
+		} else if ((r = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0){
0e5351
+			rv = ERRDATA;
0e5351
 			r = filter_error(*newch, r);
0e5351
 			break;
0e5351
 		}
0e5351
-		free(*newch);
0e5351
 		if  (r == 0)
0e5351
-			rv = makeerror(newch, n, "Read failed, %s",
0e5351
-			    strerror(errno));
0e5351
-		else
0e5351
-			rv = makeerror(newch, n, "No data");
0e5351
+			break;
0e5351
+		free(*newch);
0e5351
+		rv = ERRDATA;
0e5351
+		rv = makeerror(newch, n, "Read stderr failed, %s",
0e5351
+		    strerror(errno));
0e5351
 		goto err;
0e5351
 	}
0e5351
-
0e5351
 	*n = r;
0e5351
 	/* NUL terminate, as every buffer is handled here. */
0e5351
 	(*newch)[*n] = '\0';