diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -18,7 +18,6 @@ #include <stdio.h> #include <stdlib.h> #include <errno.h> -#include <err.h> #include <stdint.h> #include <stdbool.h> #include <string.h> @@ -139,19 +138,22 @@ int main(int argc, char **argv) { } FILE *pol = fopen(path, "r"); if (!pol) { - err(errno, "Cannot open %s", path); + fprintf(stderr, "Cannot open %s: %s\n", path, strerror(errno)); + return errno; } for (; !feof(pol) && !ferror(pol); ) { void *b = realloc(buf, buf_len += READ_INCREMENT); if (!b) { - err(errno, "Cannot allocate memory"); + fprintf(stderr, "Cannot allocate memory: %s\n", strerror(errno)); + return errno; } buf = b; pol_len += fread((void *)(buf + pol_len), 1, READ_INCREMENT, pol); } if (ferror(pol)) { - err(ferror(pol), "Cannot read the file"); + fprintf(strerror, "Cannot read the file: %s\n", strerror(ferror(pol))); + return ferror(pol); } fclose(pol); pol = NULL; |