d94afd
--- setserial-2.17/rc.serial.rc	Thu Jan 27 15:47:30 2000
d94afd
+++ setserial-2.17/rc.serial	Tue Sep 11 17:54:26 2001
d94afd
@@ -19,7 +19,7 @@
d94afd
 #
d94afd
 
d94afd
 RCLOCKFILE=/var/lock/subsys/serial
d94afd
-DIRS="/lib/modules/`uname -r`/misc /lib/modules /usr/lib/modules ."
d94afd
+DIRS="/lib/modules/`uname -r`/kernel/drivers/char /lib/modules/`uname -r`/misc /lib/modules /usr/lib/modules ."
d94afd
 PATH=/bin:/sbin:/usr/bin
d94afd
 DRIVER=serial
d94afd
 DRIVER_NAME=serial
d94afd
@@ -79,10 +79,11 @@
d94afd
 
d94afd
 if test $action  = stop ; then
d94afd
 	if test -n ${SETSERIAL} -a "$LOADED" != "no" -a \
d94afd
-           `head -1 /etc/serial.conf`X = "###AUTOSAVE###X" ; then
d94afd
+           "$(head -1 /etc/serial.conf 2>/dev/null)" = "###AUTOSAVE###" ; then
d94afd
 		echo -n "Saving state of serial devices... "
d94afd
 		grep "^#" /etc/serial.conf > /etc/.serial.conf.new
d94afd
-		${SETSERIAL} -G -g ${ALLDEVS} >> /etc/.serial.conf.new
d94afd
+		${SETSERIAL} -G -g ${ALLDEVS} \
d94afd
+			2>/dev/null >> /etc/.serial.conf.new
d94afd
 		mv /etc/serial.conf /etc/.serial.conf.old
d94afd
 		mv /etc/.serial.conf.new /etc/serial.conf
d94afd
 		echo "done."
d94afd
@@ -108,22 +109,26 @@
d94afd
 # If not stop, it must be a start....
d94afd
 #
d94afd
 
d94afd
-if test -n $MODULE -a "$LOADED" != "yes" ; then 
d94afd
+if test -n "$MODULE" -a "$LOADED" != "yes" ; then 
d94afd
+	MAPFILE=$(mktemp /tmp/$DRIVER.map.XXXXXX) \
d94afd
+	 || { echo "Couldn't create secure temporary file"; exit 1; }
d94afd
+	ERRORS=$(mktemp /tmp/$DRIVER.XXXXXX) \
d94afd
+	 || { echo "Couldn't create secure temporary file"; exit 1; }
d94afd
 	if insmod -fm $MODULE $DRIVER_ARG \
d94afd
-		> /tmp/$DRIVER.map 2> /tmp/$DRIVER.$$; then :; 
d94afd
+		> "${MAPFILE}" 2> "${ERRORS}"; then :; 
d94afd
 	else
d94afd
 		echo "Couldn't load $DRIVER_NAME driver."
d94afd
-		echo "See error logs in /tmp/$DRIVER.$$"
d94afd
+		echo "See error logs in ${ERRORS}"
d94afd
 		exit 1
d94afd
 	fi
d94afd
-	/bin/rm -f /tmp/$DRIVER.$$
d94afd
+	/bin/rm -f "${ERRORS}"
d94afd
 fi
d94afd
 
d94afd
-if test -f /etc/serial.conf ; then
d94afd
-        if test -n ${SETSERIAL} ; then
d94afd
+if test -f "/etc/serial.conf" ; then
d94afd
+        if test -n "${SETSERIAL}" ; then
d94afd
 		grep -v ^# < /etc/serial.conf | while read device args
d94afd
 		do
d94afd
-		    ${SETSERIAL} -z $device $args
d94afd
+		    ${SETSERIAL} -z $device $args 2>/dev/null
d94afd
 		done 
d94afd
 	fi
d94afd
 else
d94afd
@@ -131,4 +136,4 @@
d94afd
 fi
d94afd
 
d94afd
 touch ${RCLOCKFILE}
d94afd
-${SETSERIAL} -bg ${ALLDEVS}
d94afd
+${SETSERIAL} -bg ${ALLDEVS} 2>/dev/null