From 2c65d83fa2dba8861e8ae0e1bebe771ad2d478a2 Mon Sep 17 00:00:00 2001 From: Patrick Cheng Date: Tue, 19 Feb 2019 16:57:47 -0800 Subject: [PATCH] error_number sometime is not initialized. (#1141) 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index 3ed281df2..1fa4bb176 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -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; -- 2.47.2