https://github.com/libarchive/libarchive/pull/2797

Index: libarchive/archive_write_disk_posix.c
--- libarchive/archive_write_disk_posix.c.orig
+++ libarchive/archive_write_disk_posix.c
@@ -2561,9 +2561,9 @@ _archive_write_disk_close(struct archive *_a)
 			 * for directories. For other file types
 			 * we need to verify via fstat() or lstat()
 			 */
-			if (fd < 0 || p->filetype != AE_IFDIR) {
+			if (fd == -1 || p->filetype != AE_IFDIR) {
 #if HAVE_FSTAT
-				if (fd >= 0 && (
+				if (fd > 0 && (
 				    fstat(fd, &st) != 0 ||
 				    la_verify_filetype(st.st_mode,
 				    p->filetype) == 0)) {
@@ -4447,7 +4447,7 @@ fixup_appledouble(struct archive_write_disk *a, const 
 	 */
 	fd = open(pathname, O_RDONLY | O_BINARY | O_CLOEXEC);
 	__archive_ensure_cloexec_flag(fd);
-	if (fd < 0) {
+	if (fd == -1) {
 		archive_set_error(&a->archive, errno,
 		    "Failed to open a restoring file");
 		ret = ARCHIVE_WARN;
