]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Windows: set errno on CreateFileW failure 966/head
authorJohn Starks <jostarks@ntdev.microsoft.com>
Thu, 2 Nov 2017 17:03:28 +0000 (10:03 -0700)
committerJohn Starks <jostarks@ntdev.microsoft.com>
Thu, 2 Nov 2017 17:06:33 +0000 (10:06 -0700)
When CreateFileW fails in next_entry(), it reads from errno to set the
archive error, but errno is not set by CreateFileW. Add a call to
la_dosmaperr to set errno properly first.

libarchive/archive_read_disk_windows.c

index a69e8c377428941cd3fc5a8d1c709d242b2ee608..8fe3485240434ee9a15bd2cb1455a68f9183175d 100644 (file)
@@ -923,6 +923,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
                t->entry_fh = CreateFileW(tree_current_access_path(t),
                    GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, flags, NULL);
                if (t->entry_fh == INVALID_HANDLE_VALUE) {
+                       la_dosmaperr(GetLastError());
                        archive_set_error(&a->archive, errno,
                            "Couldn't open %ls", tree_current_path(a->tree));
                        return (ARCHIVE_FAILED);