]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
error_number sometime is not initialized. (#1141)
authorPatrick Cheng <patcheng@users.noreply.github.com>
Wed, 20 Feb 2019 00:57:47 +0000 (16:57 -0800)
committerMartin Matuška <martin@matuska.org>
Wed, 20 Feb 2019 00:57:47 +0000 (01:57 +0100)
clang analyzer flagged this.

in check_symlinks_fsobj, if open() failed, the function exits without
setting a_eno and a_estr.

libarchive/archive_write_disk_posix.c

index 3ed281df23f320a221109c89160af16854fe62ef..1fa4bb176e9cdcd4ecd59fa775eb319d22b225c3 100644 (file)
@@ -2588,8 +2588,11 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
         */
        restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
        __archive_ensure_cloexec_flag(restore_pwd);
-       if (restore_pwd < 0)
+       if (restore_pwd < 0) {
+               fsobj_error(a_eno, a_estr, errno,
+                   "Could not open ", path);
                return (ARCHIVE_FATAL);
+       }
        head = path;
        tail = path;
        last = 0;