Index: tools/jobfile.py
===================================================================
--- tools/jobfile.py	(revision 218e50c7a52d90a76c3bc3e3a344733f5eeccfa0)
+++ tools/jobfile.py	(revision a5a8ca7bfc9bf13052b7cd55872acf3123bb5c4f)
@@ -33,4 +33,5 @@
 import sys
 import os
+import fcntl
 
 def usage(prname):
@@ -49,15 +50,8 @@
 	options = " ".join(sys.argv[4:])
 	
-	if (os.path.isfile(jobfname)):
-		jobfile = file(jobfname, "r")
-		records = jobfile.read().split("\n")
-		jobfile.close()
-	else:
-		records = []
-	
-	records.append("{%s},{%s},{%s},{%s}" % (srcfname, objfname, cwd, options))
-	
-	jobfile = file(jobfname, "w")
-	jobfile.write("\n".join(records))
+	jobfile = file(jobfname, "a")
+	fcntl.lockf(jobfile, fcntl.LOCK_EX)
+	jobfile.write("{%s},{%s},{%s},{%s}\n" % (srcfname, objfname, cwd, options))
+	fcntl.lockf(jobfile, fcntl.LOCK_UN)
 	jobfile.close()
 
