From: Brett Gordon Date: Tue, 6 Jun 2017 22:42:09 +0000 (-0400) Subject: tar: bugfix: check for error on read() X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f66edb99e53ea9c59df3094b8d731eaeff8f39a1;p=FUZIX.git tar: bugfix: check for error on read() --- diff --git a/Applications/util/tar.c b/Applications/util/tar.c index 5af88976..40a5fd64 100644 --- a/Applications/util/tar.c +++ b/Applications/util/tar.c @@ -454,8 +454,12 @@ static void extract(char *argv[]) while (1) { x = read(infile, &h, 512); + if (x < 0 ){ + perror(ofile); + exit(1); + } if (x < 512) { - fprintf(stderr, "bad filesize\n"); + fprintf(stderr, "bad read size: %d\n", x); exit(1); }