summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/main.c b/main.c
index 46bfedb..f9d7b42 100644
--- a/main.c
+++ b/main.c
@@ -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;