summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBranden Robinson <branden@debian.org>2009-07-17 22:42:08 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-07-17 22:42:08 -0700
commitd6faa3c02a6f61c8d01accd0fcead28c39673e32 (patch)
tree402d13206ce253f10e6798d2a2fc8552181d3f09
parent2d6d2f121bffb378676f422b44d37534c8c5d53b (diff)
session.c: Add more debugging to execute()
[jcristau@debian.org: save errno before calling Debug() in one place]
-rw-r--r--session.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/session.c b/session.c
index ab10269..7aabed3 100644
--- a/session.c
+++ b/session.c
@@ -866,18 +866,22 @@ runAndWait (char **args, char **environ)
void
execute (char **argv, char **environ)
{
+ int err;
/* give /dev/null as stdin */
(void) close (0);
open ("/dev/null", O_RDONLY);
/* make stdout follow stderr to the log file */
dup2 (2,1);
+ Debug ("attempting to execve() %s\n", argv[0]);
execve (argv[0], argv, environ);
+ err = errno;
+ Debug ("execve() of %s failed: %s\n", argv[0], _SysErrorMsg (errno));
/*
* In case this is a shell script which hasn't been
* made executable (or this is a SYSV box), do
* a reasonable thing
*/
- if (errno != ENOENT) {
+ if (err != ENOENT) {
char program[1024], *e, *p, *optarg;
FILE *f;
char **newargv, **av;
@@ -935,6 +939,7 @@ execute (char **argv, char **environ)
while ((*av++ = *argv++))
/* SUPPRESS 530 */
;
+ Debug ("Attempting to execve() %s\n", newargv[0]);
execve (newargv[0], newargv, environ);
}
}