summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-02-16 22:22:58 -0500
committerIan Moffett <ian@osmora.org>2024-02-16 22:22:58 -0500
commit93773ef919908b91abcf41c8ccc64347bb67244b (patch)
treef3dc84efcda995fd23dbfd57c1882891fc42a331 /src
parent204517801a33f1bafab3ce1e80f71f41aa5f61a6 (diff)
Fix read_file() bug
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index a4a0e3f..91ec457 100644
--- a/src/main.c
+++ b/src/main.c
@@ -62,7 +62,7 @@ read_file(const char *fname, size_t *size_out)
size_t bufsize;
if (access(fname, F_OK) != 0) {
- fprintf(stderr, "%s does not exist!\n");
+ fprintf(stderr, "%s does not exist!\n", fname);
return NULL;
}
@@ -217,6 +217,10 @@ main(int argc, const char **argv)
#endif /* __x86_64__ */
buf = read_file(argv[1], &buf_size);
+ if (buf == NULL) {
+ return 1;
+ }
+
encrypt(&info, buf, buf_size);
writeback_file(argv[1], buf, buf_size);
free(buf);