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