From 4ec4a8e70a708d141d271f03511ce3c4ad561d04 Mon Sep 17 00:00:00 2001 From: Phillip Lougher Date: Tue, 18 Jul 2017 05:09:37 +0100 Subject: Pseudo: improve the error message when filenames with spaces are used If someone used filenames with spaces but didn't backslash the spaces (or use the new support for quoted filenames), then they'd get the less than illuminating error message "Read filename and type, but failed to read or match octal mode" Because the code would treat the filename before the first space as the filename, match the type using the first character after the space, and only then fail to parse the expected octal number. Signed-off-by: Phillip Lougher --- squashfs-tools/pseudo.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'squashfs-tools/pseudo.c') diff --git a/squashfs-tools/pseudo.c b/squashfs-tools/pseudo.c index 95635cb..a3aebb5 100644 --- a/squashfs-tools/pseudo.c +++ b/squashfs-tools/pseudo.c @@ -327,12 +327,11 @@ int read_pseudo_def(char *def) case -1: /* FALLTHROUGH */ case 0: - ERROR("Read filename, but failed to read or match " - "type\n"); - break; + /* FALLTHROUGH */ case 1: - ERROR("Read filename and type, but failed to read or " - "match octal mode\n"); + ERROR("Couldn't parse filename, type or octal mode\n"); + ERROR("If the filename has spaces, either quote it, or " + "backslash the spaces\n"); break; case 2: ERROR("Read filename, type and mode, but failed to " @@ -502,7 +501,7 @@ error: ERROR("\tfilename m mode uid gid\n"); ERROR("\tfilename b mode uid gid major minor\n"); ERROR("\tfilename c mode uid gid major minor\n"); - ERROR("\tfilename f mode uid command\n"); + ERROR("\tfilename f mode uid gid command\n"); ERROR("\tfilename s mode uid gid symlink\n"); free(filename); return FALSE; -- cgit v1.2.3