1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-10-27 20:36:18 +00:00

Test suite: Don't use "pgrep -u" when LOGNAME and USER are not set

Thanks for reporting this on IRC, luca!
This commit is contained in:
Alexander Barton 2024-04-13 15:52:33 +02:00
parent b362b5a945
commit a33d15751b

View File

@ -23,7 +23,13 @@ if [ -x /usr/bin/pgrep ]; then
*)
PGREP_FLAGS=""
esac
exec /usr/bin/pgrep $PGREP_FLAGS -n -u "${LOGNAME:-$USER}" "$1"
if [ -n "$LOGNAME" ] || [ -n "$USER" ]; then
# Try to narrow the search down to the current user ...
exec /usr/bin/pgrep $PGREP_FLAGS -n -u "${LOGNAME:-$USER}" "$1"
else
# ... but neither LOGNAME nor USER were set!
exec /usr/bin/pgrep $PGREP_FLAGS -n "$1"
fi
fi
# pidof(1) could be a good alternative on elder Linux systems