For each non-directory path argument to the ls command, the full path was
being sent to the print functions, instead of the dirname. The long output
print function expected dirname to be the directory containing the file
and so could not open the file to get the file size because the generated
path was incorrect. This caused the output to be a blank line.
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub_file_close (file);
p = grub_strrchr (dirname, '/') + 1;
- dirname = grub_strndup (dirname, p - dirname);
- if (! dirname)
+ ctx.dirname = grub_strndup (dirname, p - dirname);
+ if (ctx.dirname == NULL)
goto fail;
all = 1;
else
print_files (p, &info, &ctx);
- grub_free (dirname);
+ grub_free (ctx.dirname);
}
if (grub_errno == GRUB_ERR_NONE)