|
a/src/utils/execmd.cpp |
|
b/src/utils/execmd.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.24 2007-05-23 08:28:35 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.25 2007-07-14 16:53:00 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
16 |
* along with this program; if not, write to the
|
16 |
* along with this program; if not, write to the
|
17 |
* Free Software Foundation, Inc.,
|
17 |
* Free Software Foundation, Inc.,
|
18 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
18 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
19 |
*/
|
19 |
*/
|
20 |
#ifndef TEST_EXECMD
|
20 |
#ifndef TEST_EXECMD
|
|
|
21 |
#include "autoconfig.h"
|
|
|
22 |
|
|
|
23 |
#include <stdlib.h>
|
21 |
#include <unistd.h>
|
24 |
#include <unistd.h>
|
22 |
#include <sys/stat.h>
|
25 |
#include <sys/stat.h>
|
23 |
#include <sys/types.h>
|
26 |
#include <sys/types.h>
|
24 |
#include <sys/wait.h>
|
27 |
#include <sys/wait.h>
|
25 |
#include <sys/select.h>
|
28 |
#include <sys/select.h>
|
26 |
#include <fcntl.h>
|
29 |
#include <fcntl.h>
|
27 |
#include <errno.h>
|
30 |
#include <errno.h>
|
28 |
#include <signal.h>
|
31 |
#include <signal.h>
|
29 |
|
32 |
|
30 |
#ifdef PUTENV_ARG_NOT_CONST
|
33 |
#if !defined(PUTENV_ARG_CONST)
|
31 |
#include <string.h>
|
34 |
#include <string.h>
|
32 |
#endif
|
35 |
#endif
|
33 |
|
36 |
|
34 |
#include <list>
|
37 |
#include <list>
|
35 |
#include <vector>
|
38 |
#include <vector>
|
|
... |
|
... |
358 |
while (argv[i]) cerr << argv[i++] << endl;}
|
361 |
while (argv[i]) cerr << argv[i++] << endl;}
|
359 |
#endif
|
362 |
#endif
|
360 |
|
363 |
|
361 |
for (vector<string>::const_iterator it = m_env.begin();
|
364 |
for (vector<string>::const_iterator it = m_env.begin();
|
362 |
it != m_env.end(); it++) {
|
365 |
it != m_env.end(); it++) {
|
363 |
#ifdef PUTENV_ARG_NOT_CONST
|
366 |
#ifdef PUTENV_ARG_CONST
|
|
|
367 |
::putenv(it->c_str());
|
|
|
368 |
#else
|
364 |
::putenv(strdup(it->c_str()));
|
369 |
::putenv(strdup(it->c_str()));
|
365 |
#else
|
|
|
366 |
::putenv(it->c_str());
|
|
|
367 |
#endif
|
370 |
#endif
|
368 |
}
|
371 |
}
|
369 |
execvp(cmd.c_str(), (char *const*)argv);
|
372 |
execvp(cmd.c_str(), (char *const*)argv);
|
370 |
// Hu ho
|
373 |
// Hu ho
|
371 |
LOGERR(("ExecCmd::doexec: execvp(%s) failed. errno %d\n", cmd.c_str(),
|
374 |
LOGERR(("ExecCmd::doexec: execvp(%s) failed. errno %d\n", cmd.c_str(),
|