diff options
-rw-r--r-- | coreutils/head.c | 4 | ||||
-rw-r--r-- | head.c | 4 |
2 files changed, 2 insertions, 6 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 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <errno.h> | ||
26 | #include <stdio.h> | 25 | #include <stdio.h> |
27 | #include <getopt.h> | 26 | #include <getopt.h> |
28 | #include <stdlib.h> | 27 | #include <stdlib.h> |
@@ -82,10 +81,9 @@ int head_main(int argc, char **argv) | |||
82 | printf("==> %s <==\n", argv[optind]); | 81 | printf("==> %s <==\n", argv[optind]); |
83 | } | 82 | } |
84 | head(len, fp); | 83 | head(len, fp); |
85 | if (errno) { | 84 | if (ferror(fp)) { |
86 | perror_msg("%s", argv[optind]); | 85 | perror_msg("%s", argv[optind]); |
87 | status = EXIT_FAILURE; | 86 | status = EXIT_FAILURE; |
88 | errno = 0; | ||
89 | } | 87 | } |
90 | if (optind < argc - 1) | 88 | if (optind < argc - 1) |
91 | putchar('\n'); | 89 | putchar('\n'); |
@@ -22,7 +22,6 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <errno.h> | ||
26 | #include <stdio.h> | 25 | #include <stdio.h> |
27 | #include <getopt.h> | 26 | #include <getopt.h> |
28 | #include <stdlib.h> | 27 | #include <stdlib.h> |
@@ -82,10 +81,9 @@ int head_main(int argc, char **argv) | |||
82 | printf("==> %s <==\n", argv[optind]); | 81 | printf("==> %s <==\n", argv[optind]); |
83 | } | 82 | } |
84 | head(len, fp); | 83 | head(len, fp); |
85 | if (errno) { | 84 | if (ferror(fp)) { |
86 | perror_msg("%s", argv[optind]); | 85 | perror_msg("%s", argv[optind]); |
87 | status = EXIT_FAILURE; | 86 | status = EXIT_FAILURE; |
88 | errno = 0; | ||
89 | } | 87 | } |
90 | if (optind < argc - 1) | 88 | if (optind < argc - 1) |
91 | putchar('\n'); | 89 | putchar('\n'); |