Skip to content

Commit bc0c5d5

Browse files
authored
hexdump: warn for directories (#858)
* Avoid fatal error for directory arguments * Print a warning for a directory, then proceed to next argument * Use case tested: hexdump -C . .. file.txt
1 parent fbfdc39 commit bc0c5d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bin/hexdump

+4
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ sub xd {
216216
if (@ARGV) {
217217
while (@ARGV) {
218218
my $path = shift @ARGV;
219+
if (-d $path) {
220+
warn "$Program: $path: is a directory\n";
221+
next;
222+
}
219223
unless (open $curf, '<', $path) {
220224
warn "$Program: $path: $!\n";
221225
exit EX_FAILURE;

0 commit comments

Comments
 (0)