8a9804
diff --git a/src/compress.c b/src/compress.c
8a9804
index ba1e3d7..6846d66 100644
8a9804
--- a/src/compress.c
8a9804
+++ b/src/compress.c
8a9804
@@ -932,23 +932,23 @@ uncompressbuf(int fd, size_t bytes_max, size_t method, const unsigned char *old,
8a9804
 	rv = OKDATA;
8a9804
 	r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0);
8a9804
 	if (r <= 0) {
8a9804
-		DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
8a9804
-		    r != -1 ? strerror(errno) : "no data");
8a9804
-
8a9804
-		rv = ERRDATA;
8a9804
-		if (r == 0 &&
8a9804
-		    (r = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0)
8a9804
-		{
8a9804
-			r = filter_error(*newch, r);
8a9804
-			goto ok;
8a9804
-		}
8a9804
-		free(*newch);
8a9804
-		if  (r == 0)
8a9804
-			rv = makeerror(newch, n, "Read failed, %s",
8a9804
-			    strerror(errno));
8a9804
-		else
8a9804
-			rv = makeerror(newch, n, "No data");
8a9804
-		goto err;
8a9804
+		if (r < 0) {
8a9804
+                        rv = ERRDATA;
8a9804
+                        DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
8a9804
+                                strerror(errno));
8a9804
+                        goto err;
8a9804
+                } else if ((r = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0){
8a9804
+                        rv = ERRDATA;
8a9804
+                        r = filter_error(*newch, r);
8a9804
+                        goto ok;
8a9804
+                }
8a9804
+                if (r == 0)
8a9804
+                        goto ok;
8a9804
+                free(*newch);
8a9804
+                rv = ERRDATA;
8a9804
+                rv = makeerror(newch, n, "Read stderr failed, %s",
8a9804
+                    strerror(errno));
8a9804
+                goto err;
8a9804
 	}
8a9804
 ok:
8a9804
 	*n = r;