Commit Graph

12 Commits

Author SHA1 Message Date
Mattias Andrée 7315b8686f which: check AT_EACCESS
A file is executable only if the effective user
have permission to execute it. The real user's
permissions do not matter.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2019-07-30 07:40:35 -07:00
Mattias Andrée be34c4a24d which: remove unnecessary third parameter in O_RDONLY call to open(3)
Signed-off-by: Mattias Andrée <maandree@kth.se>
2019-07-29 18:49:14 -07:00
Michael Forney 38cc01b887 which: Minor simplification 2017-10-21 12:44:09 -07:00
Michael Forney 3b604b179c which: Don't look for paths with slashes in $PATH 2017-10-21 12:44:09 -07:00
Michael Forney 44265b29ce which: Move executable check to helper function 2017-10-21 12:44:09 -07:00
Pieter Kockx 5b66e55a83 which: handle relative/absolute pathnames 2017-10-21 12:44:09 -07:00
Pieter Kockx d15f49e715 which: fix whitespace 2017-10-21 12:44:09 -07:00
Quentin Rameau 6e7743eb56 Cleanup usage() across sbase
Some tools didn't use argv0 for tool name, or usage() at all.
2015-12-21 18:07:25 +00:00
sin 2366164de7 No need for semicolon after ARGEND
This is also the style used in Plan 9.
2015-11-01 10:18:55 +00:00
sin 68fb6754ba which: Add LICENSE header 2015-04-27 19:33:57 +01:00
FRIGN b333176b8c Refactor and audit which(1)
Use the *at functions instead of building paths manually. We do
still have path-building in recurse() and other areas, but the
long-term goal is to rid most interfaces of that for practical
and security reasons.
In this case, it's more or less trivial.

Also, refactor the manpage to be more consistent with the others.

BUGFIX: Return exit status 3 on error.
2015-04-27 19:33:57 +01:00
Hiltjo Posthuma 58cb564bbd add which 2015-04-27 16:58:42 +01:00