aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkiss9
1 files changed, 5 insertions, 4 deletions
diff --git a/kiss b/kiss
index b4fecfe..c0b41a6 100755
--- a/kiss
+++ b/kiss
@@ -71,10 +71,11 @@ as_root() {
# 'doas' or 'su'. Hurrah for choice.
[ "$uid" = 0 ] || log "Using '${su:-su}' (to become ${user:=root})"
- case $su in
- *sudo) sudo -E -u "$user" -- "$@" ;;
- *doas) doas -u "$user" -- "$@" ;;
- *) su -pc "$* <&3" "$user" 3<&0 </dev/tty ;;
+ case ${su##*/} in
+ sudo) sudo -E -u "$user" -- "$@" ;;
+ doas) doas -u "$user" -- "$@" ;;
+ su) su -pc "env USER=$user $* <&3" "$user" 3<&0 </dev/tty ;;
+ *) die "Invalid KISS_SU value: $su" ;;
esac
}