Index: /lm-sensors/trunk/prog/pwm/fancontrol.pl
===================================================================
--- /lm-sensors/trunk/prog/pwm/fancontrol.pl	(revision 2602)
+++ /lm-sensors/trunk/prog/pwm/fancontrol.pl	(revision 2605)
@@ -66,4 +66,5 @@
 our @afcminstart;
 our @afcminstop;
+our $fanrestored;
 
 sub loadconfig($);
@@ -299,20 +300,24 @@
 sub restorefans()
 {
-   $SIG{TERM} = 'IGNORE';
-   $SIG{HUP}  = 'IGNORE';
-   $SIG{INT}  = 'IGNORE';
-   $SIG{QUIT} = 'IGNORE';
-
-   print("Aborting, restoring fans...\n");
-   my $fcvcount = 0;
-
-   while ( $fcvcount < $#afcpwm+1)
-     {
-       my $pwmo = $afcpwm[$fcvcount];
-       &pwmdisable($afcpwm[$fcvcount]);
-       $fcvcount++;
-     }
-   print("Verify fans have returned to full speed\n");
-   exit(0);
+   unless ($fanrestored)
+     {
+       $SIG{TERM} = 'IGNORE';
+       $SIG{HUP}  = 'IGNORE';
+       $SIG{INT}  = 'IGNORE';
+       $SIG{QUIT} = 'IGNORE';
+
+       print("Aborting, restoring fans...\n");
+       my $fcvcount = 0;
+
+       while ($fcvcount < $#afcpwm+1)
+         {
+           my $pwmo = $afcpwm[$fcvcount];
+           &pwmdisable($afcpwm[$fcvcount]);
+           $fcvcount++;
+         }
+       print("Verify fans have returned to full speed\n");
+       $fanrestored = 1;
+       exit(0);
+     }
 }
 
