summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-12-14 15:13:23 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-12-14 15:14:18 +0100
commit73711939b54f1eb2f8235daaa41adee65ebd2bd0 (patch)
treeb91a1a0fc7cd587ad216d462eee5751e7bc78238
parent13276810b1b892d4aad62e2362e00afbe654b5b2 (diff)
rdsquashfs: improve unpacking error message on Windows
Print a proper error description instead of just an error code. If the error is ERROR_FILE_EXISTS, print out a hint that this might be caused by a case in-sensitivity issue. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--bin/rdsquashfs/restore_fstree.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/rdsquashfs/restore_fstree.c b/bin/rdsquashfs/restore_fstree.c
index b9f92fe..ea9d4f1 100644
--- a/bin/rdsquashfs/restore_fstree.c
+++ b/bin/rdsquashfs/restore_fstree.c
@@ -40,11 +40,19 @@ static int create_node(const sqfs_tree_node_t *n, const char *name, int flags)
free(wpath);
return 0;
-fail:
- fprintf(stderr, "Creating %s: %ld\n", name, GetLastError());
+fail: {
+ DWORD err = GetLastError();
free(wpath);
+ SetLastError(err);
+ w32_perror(name);
+
+ if (err == ERROR_FILE_EXISTS) {
+ fputs("\nHINT: this could be caused by case "
+ "sensitivity on Windows.\n", stderr);
+ }
return -1;
}
+}
#else
static int create_node(const sqfs_tree_node_t *n, const char *name, int flags)
{