svn commit: trunk/busybox/coreutils
vda at busybox.net
vda at busybox.net
Tue Nov 11 22:43:10 UTC 2008
Author: vda
Date: 2008-11-11 14:43:10 -0800 (Tue, 11 Nov 2008)
New Revision: 24008
Log:
head: report file open errors with exitcode 1 (was happily returning 0)
head_main 409 417 +8
Modified:
trunk/busybox/coreutils/head.c
Changeset:
Modified: trunk/busybox/coreutils/head.c
===================================================================
--- trunk/busybox/coreutils/head.c 2008-11-11 22:36:58 UTC (rev 24007)
+++ trunk/busybox/coreutils/head.c 2008-11-11 22:43:10 UTC (rev 24008)
@@ -40,7 +40,6 @@
int count_bytes = 0;
int header_threshhold = 1;
#endif
-
FILE *fp;
const char *fmt;
char *p;
@@ -50,7 +49,7 @@
#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
/* Allow legacy syntax of an initial numeric option without -n. */
- if (argc > 1 && argv[1][0] == '-'
+ if (argv[1] && argv[1][0] == '-'
&& isdigit(argv[1][1])
) {
--argc;
@@ -79,7 +78,6 @@
#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
GET_COUNT:
#endif
-
#if !ENABLE_FEATURE_FANCY_HEAD
count = xatoul(p);
#else
@@ -128,10 +126,12 @@
putchar(c);
}
if (fclose_if_not_stdin(fp)) {
- bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */
+ bb_simple_perror_msg(*argv);
retval = EXIT_FAILURE;
}
die_if_ferror_stdout();
+ } else {
+ retval = EXIT_FAILURE;
}
fmt = header_fmt_str;
} while (*++argv);
More information about the busybox-cvs
mailing list