[2/6] policycoreutils: fixfiles: remove (broken) redundant code
diff mbox

Message ID 20170504170122.26882-2-alan.christopher.jenkins@gmail.com
State Not Applicable
Headers show

Commit Message

Alan Jenkins May 4, 2017, 5:01 p.m. UTC
setfiles is now run with $exclude_dirs.
We shouldn't need to patch the file contexts as well.

This is fortunate, since the file context patching code was broken
(by the same commit which introduced the redundancy).  It takes the
list of directories to exclude from $tempdirs, but $tempdirs is
never set.

Also messages about skipping directories were printed twice.  Firstly when
exclude_dirs is generated, and secondly in the file context patching code.

Also TEMPFCFILE was only removed in one path out of several.
---
 policycoreutils/scripts/fixfiles | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

Patch
diff mbox

diff --git a/policycoreutils/scripts/fixfiles b/policycoreutils/scripts/fixfiles
index 75d7762..7e5ce88 100755
--- a/policycoreutils/scripts/fixfiles
+++ b/policycoreutils/scripts/fixfiles
@@ -230,21 +230,6 @@  fi
 LogReadOnly
 #
 exclude_dirs="`exclude_dirs_from_relabelling $OPTION`"
-if [ -n "${exclude_dirs}" ]
-then
-	TEMPFCFILE=`mktemp ${FC}.XXXXXXXXXX`
-	test -z "$TEMPFCFILE" && exit
-	/bin/cp -p ${FC} ${TEMPFCFILE} &>/dev/null || exit
-	tmpdirs=${tempdirs//-e/}
-	for p in ${tmpdirs}
-	do
-		p="${p%/}"
-		p1="${p}(/.*)? -- <<none>>"
-		echo "${p1}" >> $TEMPFCFILE
-		logit "skipping the directory ${p}"
-	done
-FC=$TEMPFCFILE
-fi
 if [ ! -z "$RPMFILES" ]; then
     for i in `echo "$RPMFILES" | sed 's/,/ /g'`; do
 	rpmlist $i | ${RESTORECON} $exclude_dirs ${FORCEFLAG} ${VERBOSE} $* -R -i -f - >>$LOGFILE 2>&1
@@ -265,7 +250,7 @@  if [ ${OPTION} != "Relabel" ]; then
     return
 fi
 echo "Cleaning up labels on /tmp"
-rm -rf /tmp/gconfd-* /tmp/pulse-* /tmp/orbit-* $TEMPFCFILE
+rm -rf /tmp/gconfd-* /tmp/pulse-* /tmp/orbit-*
 
 UNDEFINED=`get_undefined_type` || exit $?
 UNLABELED=`get_unlabeled_type` || exit $?