diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-20T09·20+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-04-20T09·20+0000 |
commit | d66ea83a763a36e7e7b9558b90abcfe09bec1b85 (patch) | |
tree | 6eaa7fc607da31c6ed3e221826cb1d6be43a6c9b /src/libutil/util.cc | |
parent | f71ea9c911294ec72f52137175ad088a2f50ab97 (diff) | |
parent | aac5fcfbb54ff64c593d8919f7f52025415ea996 (diff) |
* Sync with the trunk.
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 3f76be670839..1c1c9a9e5b74 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -809,7 +809,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; @@ -819,7 +820,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); } @@ -827,8 +828,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 |