From 4afd9632251a8c050a44e8cad8fc2ccc45a35a2a Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 26 Aug 2020 18:23:35 +0200 Subject: Fix rdsquashfs unpack under Windows if a directory exists Behave the same way as the POSIX port and do not treat that as an error. Signed-off-by: David Oberhollenzer --- bin/rdsquashfs/restore_fstree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/rdsquashfs/restore_fstree.c b/bin/rdsquashfs/restore_fstree.c index e79f333..3d536b6 100644 --- a/bin/rdsquashfs/restore_fstree.c +++ b/bin/rdsquashfs/restore_fstree.c @@ -19,8 +19,10 @@ static int create_node(const sqfs_tree_node_t *n, const char *name, int flags) switch (n->inode->base.mode & S_IFMT) { case S_IFDIR: - if (!CreateDirectoryW(wpath, NULL)) - goto fail; + if (!CreateDirectoryW(wpath, NULL)) { + if (GetLastError() != ERROR_ALREADY_EXISTS) + goto fail; + } break; case S_IFREG: fh = CreateFileW(wpath, GENERIC_READ, -- cgit v1.2.3