1 --- a/squashfs-tools/unsquashfs.c
2 +++ b/squashfs-tools/unsquashfs.c
3 @@ -63,7 +63,7 @@ char *file_data;
5 unsigned int block_size;
6 unsigned int block_log;
7 -int lsonly = FALSE, info = FALSE, force = FALSE, short_ls = TRUE;
8 +int lsonly = FALSE, info = FALSE, force = FALSE, short_ls = TRUE, numeric_ls = FALSE;
12 @@ -518,8 +518,8 @@ int print_filename(char *pathname, struc
13 char str[11], dummy[12], dummy2[12]; /* overflow safe */
14 char *userstr, *groupstr;
16 - struct passwd *user;
17 - struct group *group;
18 + struct passwd *user = NULL;
19 + struct group *group = NULL;
23 @@ -527,8 +527,9 @@ int print_filename(char *pathname, struc
27 - user = getpwuid(inode->uid);
30 + user = getpwuid(inode->uid);
31 + if(user == NULL || numeric_ls) {
32 int res = snprintf(dummy, 12, "%d", inode->uid);
34 EXIT_UNSQUASH("snprintf failed in print_filename()\n");
35 @@ -541,8 +542,9 @@ int print_filename(char *pathname, struc
37 userstr = user->pw_name;
39 - group = getgrgid(inode->gid);
42 + group = getgrgid(inode->gid);
43 + if(group == NULL || numeric_ls) {
44 int res = snprintf(dummy2, 12, "%d", inode->gid);
46 EXIT_UNSQUASH("snprintf failed in print_filename()\n");
47 @@ -2643,6 +2645,11 @@ int main(int argc, char *argv[])
48 strcmp(argv[i], "-ll") == 0) {
51 + } else if(strcmp(argv[i], "-nls") == 0 ||
52 + strcmp(argv[i], "-nl") == 0) {
56 } else if(strcmp(argv[i], "-linfo") == 0 ||
57 strcmp(argv[i], "-li") == 0) {
59 @@ -2705,6 +2712,9 @@ options:
60 ERROR("\t-ll[s]\t\t\tlist filesystem with file "
61 "attributes (like\n");
62 ERROR("\t\t\t\tls -l output), but don't unsquash\n");
63 + ERROR("\t-nl[s]\t\t\tlist filesystem with file "
64 + "attributes (like\n");
65 + ERROR("\t\t\t\tls -n output), but don't unsquash\n");
66 ERROR("\t-f[orce]\t\tif file already exists then "
68 ERROR("\t-s[tat]\t\t\tdisplay filesystem superblock "