From 93773ef919908b91abcf41c8ccc64347bb67244b Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 16 Feb 2024 22:22:58 -0500 Subject: Fix read_file() bug Signed-off-by: Ian Moffett --- src/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3