Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf8337b

Browse files
committed
Update ipcclean to use try 'id' first for root check.
1 parent28edbdb commitbf8337b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

‎src/bin/ipcclean/ipcclean.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#
3-
# $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.17 2006/03/0316:49:21 momjian Exp $
3+
# $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.18 2006/03/0321:52:37 momjian Exp $
44
#
55

66
CMDNAME=`basename$0`
@@ -19,8 +19,19 @@ if [ "$1" = '-?' -o "$1" = "--help" ]; then
1919
exit 0
2020
fi
2121

22-
# only check $LOGNAME if $USER is not set
23-
if ["$USER"='root'-o\(!"$USER"-a"$LOGNAME"='root'\) ]
22+
# test for running as root
23+
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+
thenISROOT="Y"
32+
fi
33+
34+
if ["$ISROOT"="Y" ]
2435
then
2536
(
2637
echo"$CMDNAME: cannot be run as root"1>&2

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp