mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
Log the argv passed to virExec and virRun
This commit is contained in:
parent
f1ca068666
commit
a9a11b5393
@ -1,3 +1,7 @@
|
|||||||
|
Wed Nov 5 13:39:00 EST 2008 Cole Robinson <crobinso@redhat.com>
|
||||||
|
|
||||||
|
* src/util.c: Log the argv passed to virExec and virRun
|
||||||
|
|
||||||
Wed Nov 5 13:19:00 EST 2008 Cole Robinson <crobinso@redhat.com>
|
Wed Nov 5 13:19:00 EST 2008 Cole Robinson <crobinso@redhat.com>
|
||||||
|
|
||||||
* src/iptables.c, src/util.c, src/util.h: Move local argvToString to
|
* src/iptables.c, src/util.c, src/util.h: Move local argvToString to
|
||||||
|
49
src/util.c
49
src/util.c
@ -136,14 +136,14 @@ static int virSetNonBlock(int fd) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
virExec(virConnectPtr conn,
|
__virExec(virConnectPtr conn,
|
||||||
const char *const*argv,
|
const char *const*argv,
|
||||||
const char *const*envp,
|
const char *const*envp,
|
||||||
const fd_set *keepfd,
|
const fd_set *keepfd,
|
||||||
int *retpid,
|
int *retpid,
|
||||||
int infd, int *outfd, int *errfd,
|
int infd, int *outfd, int *errfd,
|
||||||
int flags) {
|
int flags) {
|
||||||
int pid, null, i, openmax;
|
int pid, null, i, openmax;
|
||||||
int pipeout[2] = {-1,-1};
|
int pipeout[2] = {-1,-1};
|
||||||
int pipeerr[2] = {-1,-1};
|
int pipeerr[2] = {-1,-1};
|
||||||
@ -393,6 +393,27 @@ virExec(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
virExec(virConnectPtr conn,
|
||||||
|
const char *const*argv,
|
||||||
|
const char *const*envp,
|
||||||
|
const fd_set *keepfd,
|
||||||
|
int *retpid,
|
||||||
|
int infd, int *outfd, int *errfd,
|
||||||
|
int flags) {
|
||||||
|
char *argv_str;
|
||||||
|
|
||||||
|
if ((argv_str = virArgvToString(argv)) == NULL) {
|
||||||
|
ReportError(conn, VIR_ERR_NO_MEMORY, _("command debug string"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
DEBUG0(argv_str);
|
||||||
|
VIR_FREE(argv_str);
|
||||||
|
|
||||||
|
return __virExec(conn, argv, envp, keepfd, retpid, infd, outfd, errfd,
|
||||||
|
flags);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @conn connection to report errors against
|
* @conn connection to report errors against
|
||||||
* @argv NULL terminated argv to run
|
* @argv NULL terminated argv to run
|
||||||
@ -413,9 +434,17 @@ virRun(virConnectPtr conn,
|
|||||||
const char *const*argv,
|
const char *const*argv,
|
||||||
int *status) {
|
int *status) {
|
||||||
int childpid, exitstatus, ret;
|
int childpid, exitstatus, ret;
|
||||||
|
char *argv_str;
|
||||||
|
|
||||||
if ((ret = virExec(conn, argv, NULL, NULL,
|
if ((argv_str = virArgvToString(argv)) == NULL) {
|
||||||
&childpid, -1, NULL, NULL, VIR_EXEC_NONE)) < 0)
|
ReportError(conn, VIR_ERR_NO_MEMORY, _("command debug string"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
DEBUG0(argv_str);
|
||||||
|
VIR_FREE(argv_str);
|
||||||
|
|
||||||
|
if ((ret = __virExec(conn, argv, NULL, NULL,
|
||||||
|
&childpid, -1, NULL, NULL, VIR_EXEC_NONE)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
while ((ret = waitpid(childpid, &exitstatus, 0) == -1) && errno == EINTR);
|
while ((ret = waitpid(childpid, &exitstatus, 0) == -1) && errno == EINTR);
|
||||||
|
Loading…
Reference in New Issue
Block a user