We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent28edbdb commitbf8337bCopy full SHA for bf8337b
src/bin/ipcclean/ipcclean.sh
@@ -1,6 +1,6 @@
1
#!/bin/sh
2
#
3
-# $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.17 2006/03/0316:49:21 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.18 2006/03/0321:52:37 momjian Exp $
4
5
6
CMDNAME=`basename$0`
@@ -19,8 +19,19 @@ if [ "$1" = '-?' -o "$1" = "--help" ]; then
19
exit 0
20
fi
21
22
-# only check $LOGNAME if $USER is not set
23
-if ["$USER"='root'-o\(!"$USER"-a"$LOGNAME"='root'\) ]
+# test for running as root
+
24
+ISROOT="N"
25
+if id -u>/dev/null2>&1
26
+thenif [`id -u`-eq 0 ]
27
+thenISROOT="Y"
28
+fi
29
+elif# only check $LOGNAME if $USER is not set
30
+["$USER"='root'-o\(!"$USER"-a"$LOGNAME"='root'\) ]
31
32
33
34
+if ["$ISROOT"="Y" ]
35
then
36
(
37
echo"$CMDNAME: cannot be run as root"1>&2