rho.cc: Hoist `hex output' to the top.
[rhodes] / rhodes
diff --git a/rhodes b/rhodes
index 8152999..8509a4f 100755 (executable)
--- a/rhodes
+++ b/rhodes
@@ -286,7 +286,7 @@ def maybe_cleanup_worker(dir, db, pid):
 
 def maybe_kill_worker(dir, pid):
   f = OS.path.join(dir, 'lk.%d' % pid)
-  try: fd = OS.open(f, OS.O_RDONLY)
+  try: fd = OS.open(f, OS.O_RDWR)
   except OSError, err:
     if err.errno != E.ENOENT: raise ExpectedError, 'open lockfile: %s' % err
     return
@@ -465,8 +465,9 @@ def step(dir, cmd, *args):
       ## Kill off the other jobs working on this component.  If we crash now,
       ## we lose a bunch of work. :-(
       c.execute("""SELECT pid FROM workers WHERE p = ? AND k = ?""",
-                (str(p), k))
-      for pid, in c: maybe_kill_worker(dir, pid)
+                (str(p), k - 1))
+      for pid, in c:
+        if pid != mypid: maybe_kill_worker(dir, pid)
       c.execute("""DELETE FROM workers WHERE p = ? AND k = ?""",
                 (str(p), k - 1))
       c.execute("""DELETE FROM points WHERE p = ? AND k = ?""",