aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"