Revert "policycoreutils: let output of fixfiles be redirected (as normal)"

This reverts commit ac7899fc3a,
which is not yet part of an officially tagged release
(or release candidate).

`LOGFILE=/proc/self/fd/1` was wrong.

`LOGFILE=$(tty)` was being relied on in one case (exclude_dirs),
to log messages from a function run specifically with stdout redirected
(captured into a variable).

Having `logit "message"` break inside redirected functions
is a nasty leaky abstraction.

This caused e.g. `fixfiles restore` to terminate early with the error

    skipping: No such file or directory

if the user had configured any excluded paths in
/etc/selinux/fixfiles_exclude_dirs
This commit is contained in:
Alan Jenkins 2017-05-04 18:01:17 +01:00 committed by James Carter
parent 1dc95dd558
commit b5610b0c6e

View file

@ -119,7 +119,11 @@ VERBOSE="-p"
FORCEFLAG=""
DIRS=""
RPMILES=""
LOGFILE=/proc/self/fd/1
LOGFILE=`tty`
if [ $? != 0 ]; then
LOGFILE="/dev/null"
fi
LOGGER=/usr/sbin/logger
SETFILES=/sbin/setfiles
RESTORECON=/sbin/restorecon
FILESYSTEMSRW=`get_rw_labeled_mounts`
@ -134,11 +138,11 @@ else
fi
#
# Write to LOGFILE
# Log to either syslog or a LOGFILE
#
logit () {
if [ -n $LOGFILE ]; then
echo $1 >> "$LOGFILE"
echo $1 >> $LOGFILE
fi
}
#