]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Do not require exclusive read access when reading files under windows 32/head
authorBenoît Amiaux <benoit.amiaux@gmail.com>
Fri, 4 Jan 2013 13:10:30 +0000 (14:10 +0100)
committerBenoît Amiaux <benoit.amiaux@gmail.com>
Fri, 4 Jan 2013 13:10:30 +0000 (14:10 +0100)
libarchive/archive_read_disk_windows.c
libarchive/archive_windows.c

index 9c5420d80e77a428f4162b47c5ee0fd6075fe7c5..5c0f3666ab4114e9076317cf34d7d9e3293a3087 100644 (file)
@@ -929,7 +929,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
                else
                        flags |= FILE_FLAG_SEQUENTIAL_SCAN;
                t->entry_fh = CreateFileW(tree_current_access_path(t),
-                   GENERIC_READ, 0, NULL, OPEN_EXISTING, flags, NULL);
+                   GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, flags, NULL);
                if (t->entry_fh == INVALID_HANDLE_VALUE) {
                        archive_set_error(&a->archive, errno,
                            "Couldn't open %ls", tree_current_path(a->tree));
@@ -1886,7 +1886,7 @@ tree_current_file_information(struct tree *t, BY_HANDLE_FILE_INFORMATION *st,
        
        if (sim_lstat && tree_current_is_physical_link(t))
                flag |= FILE_FLAG_OPEN_REPARSE_POINT;
-       h = CreateFileW(tree_current_access_path(t), 0, 0, NULL,
+       h = CreateFileW(tree_current_access_path(t), 0, FILE_SHARE_READ, NULL,
            OPEN_EXISTING, flag, NULL);
        if (h == INVALID_HANDLE_VALUE) {
                la_dosmaperr(GetLastError());
@@ -2115,7 +2115,7 @@ archive_read_disk_entry_from_file(struct archive *_a,
                        } else
                                desiredAccess = GENERIC_READ;
 
-                       h = CreateFileW(path, desiredAccess, 0, NULL,
+                       h = CreateFileW(path, desiredAccess, FILE_SHARE_READ, NULL,
                            OPEN_EXISTING, flag, NULL);
                        if (h == INVALID_HANDLE_VALUE) {
                                la_dosmaperr(GetLastError());
@@ -2162,7 +2162,7 @@ archive_read_disk_entry_from_file(struct archive *_a,
                if (fd >= 0) {
                        h = (HANDLE)_get_osfhandle(fd);
                } else {
-                       h = CreateFileW(path, GENERIC_READ, 0, NULL,
+                       h = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
                            OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
                        if (h == INVALID_HANDLE_VALUE) {
                                la_dosmaperr(GetLastError());
index d3bf758bb39efe38d9c381c57af5b8811f61e541..c033abde8c45115db08f964b01df841d19b9a4c3 100644 (file)
@@ -599,7 +599,7 @@ __la_stat(const char *path, struct stat *st)
        struct ustat u;
        int ret;
 
-       handle = la_CreateFile(path, 0, 0, NULL, OPEN_EXISTING,
+       handle = la_CreateFile(path, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING,
                FILE_FLAG_BACKUP_SEMANTICS,
                NULL);
        if (handle == INVALID_HANDLE_VALUE) {