Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cr-marcstevens/sha1collisiondetection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Stieger <astieger@suse.com>2017-05-08 22:51:28 +0300
committerAndreas Stieger <astieger@suse.com>2017-05-08 23:01:35 +0300
commitb1a1c67e3b9f7dad11d382e86166d0b008efa27f (patch)
tree5ff7382d857bcd6740b2fc264a68affb57f3d457
parent0572d8a302b1f62f25c1559b0de74908550ab2c3 (diff)
Print file IO error texts
-rw-r--r--src/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index ce3df75..0ed1934 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#ifndef _WIN32
#include <libgen.h>
#endif
@@ -62,7 +63,7 @@ int main(int argc, char** argv)
fd = fopen(argv[i], "rb");
if (fd == NULL)
{
- printf("cannot open file: %s\n", argv[i]);
+ fprintf(stderr, "cannot open file: %s: %s\n", argv[i], strerror(errno));
return 1;
}
@@ -75,12 +76,12 @@ int main(int argc, char** argv)
}
if (ferror(fd))
{
- printf("error while reading file: %s\n", argv[i]);
+ fprintf(stderr, "error while reading file: %s: %s\n", argv[i], strerror(errno));
return 1;
}
if (!feof(fd))
{
- printf("not end of file?: %s\n",argv[i]);
+ fprintf(stderr, "not end of file?: %s: %s\n", argv[i], strerror(errno));
return 1;
}