From a400ee753527ee9b838d27169ac3fb8cb8a1737a Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 22 Jun 1999 23:58:48 +0000 Subject: 1999-06-22 Roland McGrath * rc.sh: Clean /tmp using special hackery to nuke translators. --- daemons/rc.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/daemons/rc.sh b/daemons/rc.sh index 001a4f8b..f273bb36 100644 --- a/daemons/rc.sh +++ b/daemons/rc.sh @@ -48,7 +48,31 @@ echo -n cleaning up left over files... rm -f /etc/nologin rm -f /var/lock/LCK.* if test -d /tmp; then - (cd /tmp; find . ! -name . ! -name lost+found ! -name quotas -exec rm -rf {} \; ) + + # Forcibly remove all translators in the directory. + # It is then safe to attempt to remove files and descend directories. + function remove_translators() { + local f + for f; do + f="./$f" + settrans -pagfS "$f" + if [ -L "$f" ] || [ ! -d "$f" ]; then + rm "$f" + else + remove_translators "$f" + rmdir "$f" + fi + done + } + + (cd /tmp + for f in * .[!.] .??*; do + case "$f" in + 'lost+found'|'quotas') ;; + *) remove_translators "$f" + esac + done) + fi if test -d /var/run; then (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) -- cgit v1.2.3