diff options
author | Matt Kraai <kraai@debian.org> | 2001-08-06 20:09:09 +0400 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-08-06 20:09:09 +0400 |
commit | 2338d3176bdb6fb607a8ce81534e88522d8c516c (patch) | |
tree | bc17e5768f410ffb2b67c9d6af57c98ccc59d9b5 /coreutils | |
parent | 063c1f54eae3e1dcb8dd5c00ba9bf802357d3cb9 (diff) |
Use ferror(3) to check for errors, rather than inspecting errno. Thanks to
David Douthitt for reporting, and shame on me for writing such crappy code.
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/head.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/coreutils/head.c b/coreutils/head.c index 0c8ef3d59..688c250b1 100644 --- a/coreutils/head.c +++ b/coreutils/head.c @@ -22,7 +22,6 @@ * */ -#include <errno.h> #include <stdio.h> #include <getopt.h> #include <stdlib.h> @@ -82,10 +81,9 @@ int head_main(int argc, char **argv) printf("==> %s <==\n", argv[optind]); } head(len, fp); - if (errno) { + if (ferror(fp)) { perror_msg("%s", argv[optind]); status = EXIT_FAILURE; - errno = 0; } if (optind < argc - 1) putchar('\n'); |