projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 2.6.1
[debian/amanda]
/
common-src
/
pipespawn.c
diff --git
a/common-src/pipespawn.c
b/common-src/pipespawn.c
index 16fd67cdda4dfc916cd0e3dc71ec8bd8001049dc..28f342bdc18f5a6e7564bde5a9a1f016c11018fc 100644
(file)
--- a/
common-src/pipespawn.c
+++ b/
common-src/pipespawn.c
@@
-6,7
+6,7
@@
char skip_argument[1];
char skip_argument[1];
-pid_t pipespawnv_passwd(char *prog, int pipedef,
+pid_t pipespawnv_passwd(char *prog, int pipedef,
int need_root,
int *stdinfd, int *stdoutfd, int *stderrfd,
char **my_argv);
int *stdinfd, int *stdoutfd, int *stderrfd,
char **my_argv);
@@
-19,6
+19,7
@@
pid_t
pipespawn(
char * prog,
int pipedef,
pipespawn(
char * prog,
int pipedef,
+ int need_root,
int * stdinfd,
int * stdoutfd,
int * stderrfd,
int * stdinfd,
int * stdoutfd,
int * stderrfd,
@@
-49,7
+50,8
@@
pipespawn(
}
arglist_end(ap);
}
arglist_end(ap);
- pid = pipespawnv_passwd(prog, pipedef, stdinfd, stdoutfd, stderrfd, argv);
+ pid = pipespawnv_passwd(prog, pipedef, need_root,
+ stdinfd, stdoutfd, stderrfd, argv);
amfree(argv);
return pid;
}
amfree(argv);
return pid;
}
@@
-58,12
+60,14
@@
pid_t
pipespawnv(
char * prog,
int pipedef,
pipespawnv(
char * prog,
int pipedef,
+ int need_root,
int * stdinfd,
int * stdoutfd,
int * stderrfd,
char ** my_argv)
{
int * stdinfd,
int * stdoutfd,
int * stderrfd,
char ** my_argv)
{
- return pipespawnv_passwd(prog, pipedef, stdinfd, stdoutfd, stderrfd,
+ return pipespawnv_passwd(prog, pipedef, need_root,
+ stdinfd, stdoutfd, stderrfd,
my_argv);
}
my_argv);
}
@@
-71,6
+75,7
@@
pid_t
pipespawnv_passwd(
char * prog,
int pipedef,
pipespawnv_passwd(
char * prog,
int pipedef,
+ int need_root,
int * stdinfd,
int * stdoutfd,
int * stderrfd,
int * stdinfd,
int * stdoutfd,
int * stderrfd,
@@
-96,6
+101,7
@@
pipespawnv_passwd(
passwdvar = *my_argv++;
passwdfd = (int *)*my_argv++;
}
passwdvar = *my_argv++;
passwdfd = (int *)*my_argv++;
}
+ g_debug("pipespawnv: stdoutfd is %d", *stdoutfd);
memset(inpipe, -1, SIZEOF(inpipe));
memset(outpipe, -1, SIZEOF(outpipe));
memset(errpipe, -1, SIZEOF(errpipe));
memset(inpipe, -1, SIZEOF(inpipe));
memset(outpipe, -1, SIZEOF(outpipe));
memset(errpipe, -1, SIZEOF(errpipe));
@@
-225,6
+231,8
@@
pipespawnv_passwd(
safe_fd(-1, 0);
}
safe_fd(-1, 0);
}
+ if (need_root)
+ become_root();
execve(prog, my_argv, env);
e = strerror(errno);
error(_("error [exec %s: %s]"), prog, e);
execve(prog, my_argv, env);
e = strerror(errno);
error(_("error [exec %s: %s]"), prog, e);