David Douthitt for reporting, and shame on me for writing such crappy code.
*
*/
-#include <errno.h>
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
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');
*
*/
-#include <errno.h>
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
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');