Commit 5a36e857 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic

Add check for setcap existence

This patch modifies the daemon-util to check if setcap is present
before attempting to use it.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent e98b9550
......@@ -298,7 +298,12 @@ start() {
# Grant capabilities to daemons that need them
local daemoncaps=$(_daemon_caps $plain_name)
if [[ "$daemoncaps" != "" ]]; then
setcap $daemoncaps $(readlink -f $daemonexec)
if type -p setcap >/dev/null; then
setcap $daemoncaps $(readlink -f $daemonexec)
else
echo "setcap missing, could not set capabilities for $name." >&2
return 1
fi
fi
if type -p start-stop-daemon >/dev/null; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment