Skip to content

Commit a6add72

Browse files
committed
In ipcclean, check LOGNAME only if USER is not set.
Fixes problem with 'su' on some platforms.
1 parent 587bc81 commit a6add72

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bin/ipcclean/ipcclean.sh

Lines changed: 3 additions & 2 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.16 2006/01/05 01:56:29 momjian Exp $
3+
# $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.17 2006/03/03 16:49:21 momjian Exp $
44
#
55

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

22-
if [ "$USER" = 'root' -o "$LOGNAME" = 'root' ]
22+
# only check $LOGNAME if $USER is not set
23+
if [ "$USER" = 'root' -o \( ! "$USER" -a "$LOGNAME" = 'root' \) ]
2324
then
2425
(
2526
echo "$CMDNAME: cannot be run as root" 1>&2

0 commit comments

Comments
 (0)