From 73711939b54f1eb2f8235daaa41adee65ebd2bd0 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 14 Dec 2022 15:13:23 +0100 Subject: 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 --- bin/rdsquashfs/restore_fstree.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bin') 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) { -- cgit v1.2.3