aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-16 15:34:47 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-16 15:34:47 +0000
commit50f5124ad73585d9978ad3df980fe49178afab4b (patch)
tree4f4498c32d7518654b1796b5070aa0e68f86f933
parent93ad577d737b265a4fb921337ea7765a6dd2a27c (diff)
downloadpaludis-50f5124ad73585d9978ad3df980fe49178afab4b.tar.gz
paludis-50f5124ad73585d9978ad3df980fe49178afab4b.tar.xz
Show fork errors
-rw-r--r--paludis/util/process.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/paludis/util/process.cc b/paludis/util/process.cc
index 63366ef..0e00723 100644
--- a/paludis/util/process.cc
+++ b/paludis/util/process.cc
@@ -34,6 +34,7 @@
#include <vector>
#include <map>
#include <cstdlib>
+#include <cstring>
#include <errno.h>
#include <unistd.h>
@@ -601,7 +602,7 @@ Process::run()
pid_t child(fork());
if (-1 == child)
- throw ProcessError("fork() failed");
+ throw ProcessError("fork() failed: " + stringify(::strerror(errno)));
else if ((0 == child) ^ _imp->as_main_process)
{
try
@@ -756,7 +757,10 @@ Process::run()
act.sa_flags = 0;
sigaction(SIGCLD, &act, 0);
- if (0 != fork())
+ pid_t p(fork());
+ if (-1 == p)
+ throw ProcessError("fork() failed: " + stringify(::strerror(errno)));
+ else if (0 != p)
_exit(0);
}