git.annexia.org
/
virt-what.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6382ef1
)
virt-what.in: get effective uid in a portable way
author
Assaf Gordon
<assafgordon@gmail.com>
Mon, 15 Sep 2014 18:58:19 +0000
(18:58 +0000)
committer
Richard W.M. Jones
<rjones@redhat.com>
Tue, 16 Sep 2014 17:56:37 +0000
(18:56 +0100)
$EUID is bash-specific. Use the POSIX-compatible 'id -u' instead.
virt-what.in
patch
|
blob
|
history
diff --git
a/virt-what.in
b/virt-what.in
index
1532b90
..
3feeb60
100644
(file)
--- a/
virt-what.in
+++ b/
virt-what.in
@@
-74,8
+74,9
@@
exec_prefix=@exec_prefix@
PATH="${root}@libexecdir@:${root}/sbin:${root}/usr/sbin:${PATH}"
# Check we're running as root.
+EFFUID=$(id -u) || fail "failed to get current user id"
-if [ "x$root" = "x" ] && [ "$EUID" -ne 0 ]; then
+if [ "x$root" = "x" ] && [ "$E
FF
UID" -ne 0 ]; then
fail "this script must be run as root"
fi