]> git.seodisparate.com - SimpleArchiver/commitdiff
Add NULL check when printing cwd on temp file fail
authorStephen Seo <seo.disparate@gmail.com>
Fri, 26 Jul 2024 07:25:02 +0000 (16:25 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Fri, 26 Jul 2024 07:25:02 +0000 (16:25 +0900)
src/archiver.c

index a79f17ad89408486f43c42afdade437aac85279f..a1ea1bdbbffbe5dce0bcbbb094e7569bc8611028 100644 (file)
@@ -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 <dir>\" to change where to write temp "