Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 3789899296447b88ecc8161c9eeda636 > files > 2

lm_sensors-2.9.0-4.1.102mdk.src.rpm

--- lm_sensors-2.9.0/prog/pwm/pwmconfig.can-2005-2672	2004-12-20 15:00:10.000000000 -0700
+++ lm_sensors-2.9.0/prog/pwm/pwmconfig	2005-08-24 11:34:24.621731766 -0600
@@ -465,9 +465,11 @@
 function SaveConfig {
 	echo
 	echo "Saving configuration to $FCCONFIG..."
-	egrep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP)' /etc/fancontrol >/tmp/fancontrol
-	echo -e "INTERVAL=$INTERVAL\nFCTEMPS=$FCTEMPS\nFCFANS=$FCFANS\nMINTEMP=$MINTEMP\nMAXTEMP=$MAXTEMP\nMINSTART=$MINSTART\nMINSTOP=$MINSTOP" >>/tmp/fancontrol
-	mv /tmp/fancontrol /etc/fancontrol
+	tmpfile=`mktemp /tmp/fancontrol.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
+	trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
+	egrep -v '(INTERVAL|FCTEMPS|FCFANS|MAXTEMP|MINTEMP|MINSTART|MINSTOP)' /etc/fancontrol > $tmpfile
+	echo -e "INTERVAL=$INTERVAL\nFCTEMPS=$FCTEMPS\nFCFANS=$FCFANS\nMINTEMP=$MINTEMP\nMAXTEMP=$MAXTEMP\nMINSTART=$MINSTART\nMINSTOP=$MINSTOP" >> $tmpfile
+	mv $tmpfile /etc/fancontrol
 	#check if file was written correctly
 	echo 'Configuration saved'
 }