From 8895e4b87bb37c43f98fd73da8448829a40edf53 Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:51:07 +0800 Subject: [PATCH] rmdir: better error reporting (#803) * The old error message is not specific enough to be helpful * Allow rmdir() to fail instead of performing file tests first * $! will specifically say whether a file argument does not exist, or is not a directory --- bin/rmdir | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bin/rmdir b/bin/rmdir index 850475d9..4ad336e0 100755 --- a/bin/rmdir +++ b/bin/rmdir @@ -30,11 +30,6 @@ if (!getopts('p', \%opt) || scalar(@ARGV) == 0) { exit EX_FAILURE; } foreach my $directory (@ARGV) { - unless (-d $directory) { - warn "$Program: '$directory': not a directory or does not exist\n"; - $rc = EX_FAILURE; - next; - } unless (rmdir $directory) { warn "$Program: failed to remove '$directory': $!\n"; $rc = EX_FAILURE;