From: Stephen Seo Date: Fri, 26 Jul 2024 07:25:02 +0000 (+0900) Subject: Add NULL check when printing cwd on temp file fail X-Git-Tag: 1.0~17 X-Git-Url: https://git.seodisparate.com/stephenseo/client_config?a=commitdiff_plain;h=c30f2f3fd22818e8810c658ad76066085679c0b4;p=SimpleArchiver Add NULL check when printing cwd on temp file fail --- diff --git a/src/archiver.c b/src/archiver.c index a79f17a..a1ea1bd 100644 --- a/src/archiver.c +++ b/src/archiver.c @@ -207,8 +207,10 @@ int write_files_fn(void *data, void *ud) { SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_LINUX __attribute__((cleanup(free_malloced_memory))) void *real_cwd = realpath(".", NULL); - fprintf(stderr, "Tried to create temp file(s) in \"%s\"!\n", - (char *)real_cwd); + if (real_cwd) { + fprintf(stderr, "Tried to create temp file(s) in \"%s\"!\n", + (char *)real_cwd); + } #endif fprintf(stderr, "(Use \"--temp-files-dir \" to change where to write temp "