aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorseebs <seebs@seebs-eee.(none)>2010-08-24 16:02:38 -0500
committerseebs <seebs@seebs-eee.(none)>2010-08-25 16:48:37 -0500
commit1e7f35ab310b1af580799f10e801b182f45a08f1 (patch)
tree48b460ffd62a157eeb23816b6694d1597bc8f974
parent466472fb9b39656f0c90216b64615b3e0909997f (diff)
downloadpseudo-1e7f35ab310b1af580799f10e801b182f45a08f1.tar.gz
pseudo-1e7f35ab310b1af580799f10e801b182f45a08f1.tar.bz2
pseudo-1e7f35ab310b1af580799f10e801b182f45a08f1.zip
Initial attempt at fixing problems with SIGCHLD being blocked
in processes started under pseudo.
-rw-r--r--ChangeLog.txt4
-rw-r--r--guts/execv.c5
-rw-r--r--guts/execve.c4
-rw-r--r--guts/execvp.c4
-rwxr-xr-xmakewrappers4
-rw-r--r--pseudo_wrappers.c1
6 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 205d50e..9e39f90 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,7 @@
+2010-08-24:
+ * (seebs) try to restore signal mask before calling exec()
+ * (seebs) move errno restoration after code which could set errno
+
2010-08-19:
* (seebs) handle insane edge case involving regcomp/regexec
diff --git a/guts/execv.c b/guts/execv.c
index 59a3f96..8183442 100644
--- a/guts/execv.c
+++ b/guts/execv.c
@@ -6,7 +6,6 @@
* wrap_execv(const char *path, char *const *argv) {
* int rc = -1;
*/
-
if (!pseudo_get_value("PSEUDO_RELOADED"))
pseudo_setupenv();
else {
@@ -14,6 +13,10 @@
pseudo_dropenv();
}
+ /* if exec() fails, we may end up taking signals unexpectedly...
+ * not much we can do about that.
+ */
+ sigprocmask(SIG_SETMASK, &pseudo_saved_sigmask, NULL);
rc = real_execv(path, argv);
/* return rc;
diff --git a/guts/execve.c b/guts/execve.c
index 7cb6632..da407f5 100644
--- a/guts/execve.c
+++ b/guts/execve.c
@@ -21,6 +21,10 @@
new_environ = pseudo_dropenvp(new_environ);
}
+ /* if exec() fails, we may end up taking signals unexpectedly...
+ * not much we can do about that.
+ */
+ sigprocmask(SIG_SETMASK, &pseudo_saved_sigmask, NULL);
rc = real_execve(filename, argv, new_environ);
/* return rc;
diff --git a/guts/execvp.c b/guts/execvp.c
index 1ab34d3..8f0baa4 100644
--- a/guts/execvp.c
+++ b/guts/execvp.c
@@ -14,6 +14,10 @@
pseudo_dropenv();
}
+ /* if exec() fails, we may end up taking signals unexpectedly...
+ * not much we can do about that.
+ */
+ sigprocmask(SIG_SETMASK, &pseudo_saved_sigmask, NULL);
rc = real_execvp(file, argv);
/* return rc;
diff --git a/makewrappers b/makewrappers
index 60e8938..5b023b4 100755
--- a/makewrappers
+++ b/makewrappers
@@ -318,6 +318,8 @@ EOF
sigprocmask(SIG_SETMASK, &saved, NULL);
$(write_return $default_value);
}
+ /* this may get restored if we end up calling exec*() */
+ pseudo_saved_sigmask = saved;
$decl_paths
if (pseudo_populate_wrappers()) {
int save_errno;
@@ -341,8 +343,8 @@ $free_paths
save_errno = errno;
pseudo_droplock();
sigprocmask(SIG_SETMASK, &saved, NULL);
- errno = save_errno;
pseudo_debug(4, "completed: $name\n");
+ errno = save_errno;
$(write_return rc);
} else {
pseudo_droplock();
diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
index d7ed9f6..3ea0952 100644
--- a/pseudo_wrappers.c
+++ b/pseudo_wrappers.c
@@ -42,6 +42,7 @@ static void pseudo_droplock(void);
static size_t pseudo_dechroot(char *, size_t);
extern char *program_invocation_short_name;
+static sigset_t pseudo_saved_sigmask;
/* the generated code goes here */
#include "pseudo_wrapper_table.c"