Index: /lm-sensors/trunk/prog/pwm/fancontrol
===================================================================
--- /lm-sensors/trunk/prog/pwm/fancontrol	(revision 5667)
+++ /lm-sensors/trunk/prog/pwm/fancontrol	(revision 5668)
@@ -43,11 +43,4 @@
 #DEBUG=1
 MAX=255
-
-if [ -f "$PIDFILE" ]
-then
-	echo "File $PIDFILE exists, is fancontrol already running?"
-	exit 1
-fi
-echo $$ > "$PIDFILE"
 
 declare -i pwmval
@@ -181,4 +174,11 @@
 fi
 cd $DIR
+
+if [ -f "$PIDFILE" ]
+then
+	echo "File $PIDFILE exists, is fancontrol already running?"
+	exit 1
+fi
+echo $$ > "$PIDFILE"
 
 # $1 = pwm file name
Index: /lm-sensors/trunk/CHANGES
===================================================================
--- /lm-sensors/trunk/CHANGES	(revision 5667)
+++ /lm-sensors/trunk/CHANGES	(revision 5668)
@@ -26,4 +26,5 @@
               Drop support for kernels 2.4 and earlier
               Exit if configuration file can't be read
+              Create pid file only after successful initialization
   maxilife scripts: Delete (driver never ported to Linux 2.6)
   sensord: Accept negative temperatures in RRD database
