aboutsummaryrefslogtreecommitdiff
path: root/head.c
diff options
context:
space:
mode:
authorkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-08-06 16:09:09 +0000
committerkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-08-06 16:09:09 +0000
commit671e7f162b9942001d89733006e9b552acd79743 (patch)
treebc17e5768f410ffb2b67c9d6af57c98ccc59d9b5 /head.c
parentc23dbf0b76b57985910f5808cf5731b05f276db8 (diff)
downloadbusybox-w32-671e7f162b9942001d89733006e9b552acd79743.tar.gz
busybox-w32-671e7f162b9942001d89733006e9b552acd79743.tar.bz2
busybox-w32-671e7f162b9942001d89733006e9b552acd79743.zip
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. git-svn-id: svn://busybox.net/trunk/busybox@3214 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-rw-r--r--head.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/head.c b/head.c
index 0c8ef3d59..688c250b1 100644
--- a/head.c
+++ b/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');