Skip to contentSkip to conversation

fixfiles: make sure $LOGFILE starts with a slash

PATCH New Oskari Saarenmaa 1 participant 1 message Apr 12, 2016 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fixfiles: make sure $LOGFILE starts with a slash

tty may output a (localized) "not a tty" message to stdout and exit with a zero status in case ttyname(3) returns NULL but isatty(3) returns success. This happens at least when stdin is connected to a tty but we're inside a chroot with no access to the tty file.

This results in an error:

/usr/sbin/fixfiles: line 257: $LOGFILE: ambiguous redirect

Handle tty results that don't start with a slash the same way as no tty
errors: point $LOGFILE to /dev/null.

---
 policycoreutils/scripts/fixfiles | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
policycoreutils/scripts/fixfiles +1 -1
index 5c29eb9..1c64191 100755
@@ -120,7 +120,7 @@ FORCEFLAG=""
 DIRS=""
 RPMILES=""
 LOGFILE=`tty`
-if [ $? != 0 ]; then
+if [ $? != 0 -o ${LOGFILE:0:1} != "/" ]; then
     LOGFILE="/dev/null"
 fi
 LOGGER=/usr/sbin/logger
Signature · 1 line
2.5.5