logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: d9a9bbc47e55629b95c8dfb54e47a117f259775c
parent 9138dac995b7d5edb359d439784585746754e2c4
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 22 Sep 2025 05:29:25 +0200

cmd/which: use errno only when access() failed

Diffstat:

Mcmd/which.c24+++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/cmd/which.c b/cmd/which.c @@ -117,18 +117,20 @@ main(int argc, char *argv[]) if(!opt_a) break; } - - switch(errno) + else { - case ENOENT: - case 0: - break; - default: - fprintf(stderr, - "which: warning: Failed checking access on file '%s': %s\n", - buf, - strerror(errno)); - break; + switch(errno) + { + case ENOENT: + case 0: + break; + default: + fprintf(stderr, + "which: warning: Failed checking access on file '%s': %s\n", + buf, + strerror(errno)); + break; + } } which_cont: