aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-22 13:28:35 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-01-22 13:28:35 +0000
commit5fdadc3a91b8ef8c183f1b322a2945d79e756833 (patch)
tree78755873e0da1e0115b82ad2a30a2aec20dded78
parent24457af06d3b1e2d3367e869ddc52b1feb694b29 (diff)
downloadpaludis-5fdadc3a91b8ef8c183f1b322a2945d79e756833.tar.gz
paludis-5fdadc3a91b8ef8c183f1b322a2945d79e756833.tar.xz
Fix unthreaded build
-rw-r--r--paludis/util/system.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/paludis/util/system.cc b/paludis/util/system.cc
index dfb6a55..a31a358 100644
--- a/paludis/util/system.cc
+++ b/paludis/util/system.cc
@@ -345,8 +345,13 @@ paludis::run_command(const Command & cmd)
sigemptyset(&intandterm);
sigaddset(&intandterm, SIGINT);
sigaddset(&intandterm, SIGTERM);
+#ifdef PALUDIS_ENABLE_THREADS
if (0 != pthread_sigmask(SIG_BLOCK, &intandterm, 0))
throw InternalError(PALUDIS_HERE, "pthread_sigmask failed");
+#else
+ if (0 != sigprocmask(SIG_BLOCK, &intandterm, 0))
+ throw InternalError(PALUDIS_HERE, "sigprocmask failed");
+#endif
pid_t child(fork());
if (0 == child)
@@ -362,9 +367,13 @@ paludis::run_command(const Command & cmd)
act.sa_flags = 0;
sigaction(SIGINT, &act, 0);
sigaction(SIGTERM, &act, 0);
+#ifdef PALUDIS_ENABLE_THREADS
if (0 != pthread_sigmask(SIG_UNBLOCK, &intandterm, 0))
std::cerr << "pthread_sigmask failed: " + stringify(strerror(errno)) + "'" << std::endl;
-
+#else
+ if (0 != sigprocmask(SIG_UNBLOCK, &intandterm, 0))
+ std::cerr << "sigprocmask failed: " + stringify(strerror(errno)) + "'" << std::endl;
+#endif
try
{
if (cmd.pipe_command_handler())
@@ -475,8 +484,13 @@ paludis::run_command(const Command & cmd)
sigaddset(&act.sa_mask, SIGTERM);
sigaction(SIGINT, &act, 0);
sigaction(SIGTERM, &act, 0);
+#ifdef PALUDIS_ENABLE_THREADS
if (0 != pthread_sigmask(SIG_UNBLOCK, &intandterm, 0))
std::cerr << "pthread_sigmask failed: " + stringify(strerror(errno)) + "'" << std::endl;
+#else
+ if (0 != sigprocmask(SIG_UNBLOCK, &intandterm, 0))
+ std::cerr << "sigprocmask failed: " + stringify(strerror(errno)) + "'" << std::endl;
+#endif
if (cmd.pipe_command_handler())
{
@@ -548,8 +562,13 @@ paludis::run_command(const Command & cmd)
/* Our original pid */
/* Restore SIGINT and SIGTERM handling */
+#ifdef PALUDIS_ENABLE_THREADS
if (0 != pthread_sigmask(SIG_UNBLOCK, &intandterm, 0))
throw InternalError(PALUDIS_HERE, "pthread_sigmask failed");
+#else
+ if (0 != sigprocmask(SIG_UNBLOCK, &intandterm, 0))
+ throw InternalError(PALUDIS_HERE, "sigprocmask failed");
+#endif
if (cmd.pipe_command_handler())
{