]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
read_disk: Set correct match error codes 2927/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 18 Mar 2026 14:53:41 +0000 (15:53 +0100)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 9 May 2026 10:18:38 +0000 (12:18 +0200)
The errno value is not correct here. If the error string of a failed
match is printed, use also its error code.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read_disk_posix.c
libarchive/archive_read_disk_windows.c

index a7176bdd939dd6de710828ba5213e8f5efdfd814..a12c2113404f286f58183208aea7d10bd67f7a82 100644 (file)
@@ -920,7 +920,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
        if (a->matching) {
                r = archive_match_path_excluded(a->matching, entry);
                if (r < 0) {
-                       archive_set_error(&(a->archive), errno,
+                       archive_set_error(&(a->archive), archive_errno(a->matching),
                            "%s", archive_error_string(a->matching));
                        return (r);
                }
@@ -1034,7 +1034,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
        if (a->matching) {
                r = archive_match_time_excluded(a->matching, entry);
                if (r < 0) {
-                       archive_set_error(&(a->archive), errno,
+                       archive_set_error(&(a->archive), archive_errno(a->matching),
                            "%s", archive_error_string(a->matching));
                        return (r);
                }
@@ -1060,7 +1060,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
        if (a->matching) {
                r = archive_match_owner_excluded(a->matching, entry);
                if (r < 0) {
-                       archive_set_error(&(a->archive), errno,
+                       archive_set_error(&(a->archive), archive_errno(a->matching),
                            "%s", archive_error_string(a->matching));
                        return (r);
                }
index 0e890497a443d962435318edf1a4f6eab27ccda2..ac01179628fdf67f049c78c0829d8a0fdc0549fe 100644 (file)
@@ -946,7 +946,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
        if (a->matching) {
                r = archive_match_path_excluded(a->matching, entry);
                if (r < 0) {
-                       archive_set_error(&(a->archive), errno,
+                       archive_set_error(&(a->archive), archive_errno(a->matching),
                            "%s", archive_error_string(a->matching));
                        return (r);
                }
@@ -1018,7 +1018,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
        if (a->matching) {
                r = archive_match_time_excluded(a->matching, entry);
                if (r < 0) {
-                       archive_set_error(&(a->archive), errno,
+                       archive_set_error(&(a->archive), archive_errno(a->matching),
                            "%s", archive_error_string(a->matching));
                        return (r);
                }
@@ -1044,7 +1044,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
        if (a->matching) {
                r = archive_match_owner_excluded(a->matching, entry);
                if (r < 0) {
-                       archive_set_error(&(a->archive), errno,
+                       archive_set_error(&(a->archive), archive_errno(a->matching),
                            "%s", archive_error_string(a->matching));
                        return (r);
                }