[Pkg-sysvinit-commits] r581 - in sysvinit/trunk/debian: . initscripts/etc/init.d

Thomas Hood jdthood-guest at costa.debian.org
Wed Jan 11 11:38:56 UTC 2006


Author: jdthood-guest
Date: 2006-01-11 11:38:55 +0000 (Wed, 11 Jan 2006)
New Revision: 581

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/initscripts/etc/init.d/umountnfs.sh
Log:
Use exec to redirect stdin, rather than a subshell.

Here is the diff with whitespace changes ignored:

--- initscripts/etc/init.d/umountnfs.sh (revision 580)
+++ initscripts/etc/init.d/umountnfs.sh (working copy)
@@ -39,10 +39,11 @@
        log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"

        #
-       # Read mtab file and add the directories we want to
-       # unmount in reverse to a list.
+       # Make list of points to unmount in reverse order of their creation
        #
-       (
+
+       exec 9<&0 </proc/mounts
+
                DIRS=""
                while read DEV MTPT FSTYPE REST
                do
@@ -60,12 +61,13 @@
                                ;;
                        esac
                done
-               exec </dev/null
+
+       exec 0<&9 9<&-
+
                if [ "$DIRS" ]
                then
                        umount $FLAGS $DIRS
                fi
-       ) < /proc/mounts

        log_action_end_msg 0
 }





Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2006-01-11 11:01:47 UTC (rev 580)
+++ sysvinit/trunk/debian/changelog	2006-01-11 11:38:55 UTC (rev 581)
@@ -1,10 +1,11 @@
-sysvinit (2.86.ds1-10~7) experimental; urgency=low 
+sysvinit (2.86.ds1-10~8) experimental; urgency=low 
 
   [ Thomas Hood ]
   * rcS(5): Reword
   * bootclean: Adapt from old bootclean.sh; handle return status more
     carefully; print diagnostic messages on failures; eliminate use of
     subshells; add comments
+  * umountnfs.sh: Eliminate unnecessary use of subshell
   * debian/rules:
     + Use ':', not the deprecated '.' between owner and group names
       in chown commands

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/umountnfs.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/umountnfs.sh	2006-01-11 11:01:47 UTC (rev 580)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/umountnfs.sh	2006-01-11 11:38:55 UTC (rev 581)
@@ -39,34 +39,36 @@
 	log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"
 
 	#
-	# Read mtab file and add the directories we want to
-	# unmount in reverse to a list.
+	# Make list of points to unmount in reverse order of their creation
 	#
-	(
-		DIRS=""
-		while read DEV MTPT FSTYPE REST
-		do
-			case "$MTPT" in
-			  /|/proc|/dev|/dev/pts|/proc/*|/sys)
-				continue
-				;;
-			esac
-			case "$FSTYPE" in
-			  nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs)
-				DIRS="$MTPT $DIRS"
-				;;
-			  proc|procfs|linprocfs|devfs|devpts|usbfs|usbdevfs|sysfs)
-				DIRS="$MTPT $DIRS"
-				;;
-			esac
-		done
-		exec </dev/null
-		if [ "$DIRS" ]
-		then
-			umount $FLAGS $DIRS
-		fi
-	) < /proc/mounts
 
+	exec 9<&0 </proc/mounts
+
+	DIRS=""
+	while read DEV MTPT FSTYPE REST
+	do
+		case "$MTPT" in
+		  /|/proc|/dev|/dev/pts|/proc/*|/sys)
+			continue
+			;;
+		esac
+		case "$FSTYPE" in
+		  nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs)
+			DIRS="$MTPT $DIRS"
+			;;
+		  proc|procfs|linprocfs|devfs|devpts|usbfs|usbdevfs|sysfs)
+			DIRS="$MTPT $DIRS"
+			;;
+		esac
+	done
+
+	exec 0<&9 9<&-
+
+	if [ "$DIRS" ]
+	then
+		umount $FLAGS $DIRS
+	fi
+
 	log_action_end_msg 0
 }
 




More information about the Pkg-sysvinit-commits mailing list