From 52d0590bca46d1368a6c5588d214e3724ebad358 Mon Sep 17 00:00:00 2001
From: Thomas Bushnell <thomas@gnu.org>
Date: Thu, 1 Jul 1999 19:26:34 +0000
Subject: 1999-07-01  Thomas Bushnell, BSG  <tb@mit.edu>

	* rc.sh: Specify bash instead of sh.
	(remove_translators): Don't descend into "." or "..".  Alter
	calling convention slightly and require the `nullglob' option to
	be set.  Change caller to suit.  From Kalle Olavi Niemitalo
	<tosi@ees2.oulu.fi>.
---
 daemons/ChangeLog |  8 ++++++++
 daemons/rc.sh     | 11 +++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

(limited to 'daemons')

diff --git a/daemons/ChangeLog b/daemons/ChangeLog
index bdacfdb9..ace04649 100644
--- a/daemons/ChangeLog
+++ b/daemons/ChangeLog
@@ -1,3 +1,11 @@
+1999-07-01  Thomas Bushnell, BSG  <tb@mit.edu>
+
+	* rc.sh: Specify bash instead of sh.
+	(remove_translators): Don't descend into "." or "..".  Alter
+	calling convention slightly and require the `nullglob' option to
+	be set.  Change caller to suit.  From Kalle Olavi Niemitalo
+	<tosi@ees2.oulu.fi>.
+
 1999-06-22  Roland McGrath  <roland@baalperazim.frob.com>
 
 	* rc.sh: Clean /tmp using special hackery to nuke translators.
diff --git a/daemons/rc.sh b/daemons/rc.sh
index f273bb36..75afa4df 100644
--- a/daemons/rc.sh
+++ b/daemons/rc.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 PATH=/bin:/sbin
 
 swapon -a
@@ -51,28 +51,31 @@ if test -d /tmp; then
 
   # Forcibly remove all translators in the directory.
   # It is then safe to attempt to remove files and descend directories.
+  # All parameters must begin with "./".
   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"
+	remove_translators "$f"/* "$f"/.[!.] "$f"/.??*
 	rmdir "$f"
       fi
     done
   }
 
   (cd /tmp
+   shopt -s nullglob
    for f in * .[!.] .??*; do
      case "$f" in
      'lost+found'|'quotas') ;;
-     *) remove_translators "$f"
+     *) remove_translators "./$f"
      esac
    done)
 
+  unset -f remove_translators  # because it relies on nullglob
+
 fi
 if test -d /var/run; then
   (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
-- 
cgit v1.2.3