about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-03-19T11·36+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-03-19T11·36+0000
commit141294ff38fb3623ae24c2d47cf0c3180cc363d3 (patch)
treee62e0863daab9a14d0d4373a45ef6996c104b684 /src
parent74299c1cfb770fee1860e62701cd093faffa0119 (diff)
* Clean up error messages in killUser().
Diffstat (limited to 'src')
-rw-r--r--src/libutil/util.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index eec60867dfc8..790c2576802e 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -810,7 +810,8 @@ void killUser(uid_t uid)
     case 0:
         try { /* child */
 
-            if (setuid(uid) == -1) abort();
+            if (setuid(uid) == -1)
+                throw SysError("setting uid");
 
 	    while (true) {
 		if (kill(-1, SIGKILL) == 0) break;
@@ -820,7 +821,7 @@ void killUser(uid_t uid)
 	    }
 
         } catch (std::exception & e) {
-            std::cerr << format("killing processes beloging to uid `%1%': %1%")
+            std::cerr << format("killing processes belonging to uid `%1%': %2%")
                 % uid % e.what() << std::endl;
             quickExit(1);
         }
@@ -828,8 +829,9 @@ void killUser(uid_t uid)
     }
     
     /* parent */
-    if (pid.wait(true) != 0)
-        throw Error(format("cannot kill processes for uid `%1%'") % uid);
+    int status = pid.wait(true);
+    if (status != 0)
+        throw Error(format("cannot kill processes for uid `%1%': %2%") % uid % statusToString(status));
 
     /* !!! We should really do some check to make sure that there are
        no processes left running under `uid', but there is no portable