git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 28edbdb)
Update ipcclean to use try 'id' first for root check.
Fri, 3 Mar 2006 21:52:37 +0000 (21:52 +0000)
Fri, 3 Mar 2006 21:52:37 +0000 (21:52 +0000)

diff --git a/src/bin/ipcclean/ipcclean.sh b/src/bin/ipcclean/ipcclean.sh
index 9fc764e8a9a6fb78ec91156513d7ba3b088fe471..f55f8c7e3a44cf067408b104758040c00e8667b3 100644 (file)
--- a/src/bin/ipcclean/ipcclean.sh
+++ b/src/bin/ipcclean/ipcclean.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.17 2006年03月03日 16:49:21 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.18 2006年03月03日 21:52:37 momjian Exp $
#
CMDNAME=`basename 0ドル`
@@ -19,8 +19,19 @@ if [ "1ドル" = '-?' -o "1ドル" = "--help" ]; then
exit 0
fi
-# only check $LOGNAME if $USER is not set
-if [ "$USER" = 'root' -o \( ! "$USER" -a "$LOGNAME" = 'root' \) ]
+# test for running as root
+
+ISROOT="N"
+if id -u >/dev/null 2>&1
+then if [ `id -u` -eq 0 ]
+ then ISROOT="Y"
+ fi
+elif # only check $LOGNAME if $USER is not set
+ [ "$USER" = 'root' -o \( ! "$USER" -a "$LOGNAME" = 'root' \) ]
+then ISROOT="Y"
+fi
+
+if [ "$ISROOT" = "Y" ]
then
(
echo "$CMDNAME: cannot be run as root" 1>&2
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /