Skip to content

Commit

Permalink
restorecond: compatible with the use of EUID
Browse files Browse the repository at this point in the history
The `EUID` does not exist in some shell environments. To ensure compatibility,
use `id -u` instead of `EUID` when `EUID` does not exist.

Signed-off-by: Huizhao Wang <[email protected]>
Acked-by: Petr Lautrbach <[email protected]>
  • Loading branch information
Huizhao Wang authored and jwcart2 committed Nov 7, 2023
1 parent 6df403d commit ca76a88
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion restorecond/restorecond.init
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin
[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || exit 7

# Check that we are root ... so non-root users stop here
test $EUID = 0 || exit 4
if [ $EUID ]; then
test $EUID = 0 || exit 4
else
test `id -u` = 0 || exit 4
fi

test -x /usr/sbin/restorecond || exit 5
test -f /etc/selinux/restorecond.conf || exit 6
Expand Down

0 comments on commit ca76a88

Please sign in to comment.