X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=util-linux%2Fhexdump.c;h=f3878f44ffefb52d4543bfd1e84780a8a7952b07;hb=4e5b07b0fed4be34ab3b22666e2a68e7ec2738d8;hp=4d2b0592ba3e394671c68c1462a7ae918ec367a0;hpb=55f7912ddaea7c21068a48841a6eb933e5f286ee;p=oweals%2Fbusybox.git diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 4d2b0592b..f3878f44f 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -14,18 +14,15 @@ /* This is a NOEXEC applet. Be very careful! */ - static void bb_dump_addfile(dumper_t *dumper, char *name) { char *p; FILE *fp; char *buf; - fp = xfopen(name, "r"); - + fp = xfopen_for_read(name); while ((buf = xmalloc_fgetline(fp)) != NULL) { p = skip_whitespace(buf); - if (*p && (*p != '#')) { bb_dump_add(dumper, p); } @@ -44,13 +41,13 @@ static const char *const add_strings[] = { static const char add_first[] ALIGN1 = "\"%07.7_Ax\n\""; -static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v" USE_FEATURE_HEXDUMP_REVERSE("R"); +static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v" IF_FEATURE_HEXDUMP_REVERSE("R"); static const struct suffix_mult suffixes[] = { { "b", 512 }, { "k", 1024 }, { "m", 1024*1024 }, - { } + { "", 0 } }; int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; @@ -131,7 +128,7 @@ int hexdump_main(int argc, char **argv) do { char *buf; - fp = xfopen(*argv, "r"); + fp = xfopen_for_read(*argv); jump_in: while ((buf = xmalloc_fgetline(fp)) != NULL) { p = buf;