about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-05T18·07+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-05T18·07+0000
commit4c1c37d0b6f4f8e7331b359617d7071c5e6e42fb (patch)
treea974fd42647c26b368de4fb9e97b6020c18faea6 /src
parent8d1854c3f19848fa6435aaa0fc688230ccc478c2 (diff)
* FreeBSD returns ESRCH when there are no processes to kill.
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 202fb0ac44e3..6e71c2c7d4e7 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -450,11 +450,15 @@ static void killUser(uid_t uid)
 
             if (setuid(uid) == -1) abort();
 
-            if (kill(-1, SIGKILL) == -1)
-                throw SysError(format("cannot kill processes for UID `%1%'") % uid);
+	    while (true) {
+		if (kill(-1, SIGKILL) == 0) break;
+		if (errno == ESRCH) break; /* no more processes */
+		if (errno != EINTR)
+		    throw SysError(format("cannot kill processes for UID `%1%'") % uid);
+	    }
         
         } catch (std::exception & e) {
-            std::cerr << format("build error: %1%\n") % e.what();
+            std::cerr << format("killing build users: %1%\n") % e.what();
             quickExit(1);
         }
         quickExit(0);
@@ -965,7 +969,7 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook()
             throw SysError(format("executing `%1%'") % buildHook);
             
         } catch (std::exception & e) {
-            std::cerr << format("build error: %1%\n") % e.what();
+            std::cerr << format("build hook error: %1%\n") % e.what();
         }
         quickExit(1);
     }