|
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.23 2007-05-21 13:30:22 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.24 2007-05-23 08:28:35 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
|
|
... |
|
... |
178 |
return -1;
|
178 |
return -1;
|
179 |
}
|
179 |
}
|
180 |
|
180 |
|
181 |
if (e.pid) {
|
181 |
if (e.pid) {
|
182 |
// Father process
|
182 |
// Father process
|
|
|
183 |
sigset_t blkcld;
|
|
|
184 |
sigemptyset(&blkcld);
|
|
|
185 |
sigaddset(&blkcld, SIGCHLD);
|
|
|
186 |
pthread_sigmask(SIG_BLOCK, &blkcld, 0);
|
|
|
187 |
|
183 |
if (input) {
|
188 |
if (input) {
|
184 |
close(e.pipein[0]);
|
189 |
close(e.pipein[0]);
|
185 |
e.pipein[0] = -1;
|
190 |
e.pipein[0] = -1;
|
186 |
fcntl(e.pipein[1], F_SETFL, O_NONBLOCK);
|
191 |
fcntl(e.pipein[1], F_SETFL, O_NONBLOCK);
|
187 |
}
|
192 |
}
|
|
... |
|
... |
278 |
if (!m_cancelRequest) {
|
283 |
if (!m_cancelRequest) {
|
279 |
(void)waitpid(e.pid, &status, 0);
|
284 |
(void)waitpid(e.pid, &status, 0);
|
280 |
e.pid = -1;
|
285 |
e.pid = -1;
|
281 |
}
|
286 |
}
|
282 |
LOGDEB1(("ExecCmd::doexec: father got status 0x%x\n", status));
|
287 |
LOGDEB1(("ExecCmd::doexec: father got status 0x%x\n", status));
|
|
|
288 |
pthread_sigmask(SIG_UNBLOCK, &blkcld, 0);
|
|
|
289 |
|
283 |
return haderror ? -1 : status;
|
290 |
return haderror ? -1 : status;
|
284 |
|
291 |
|
285 |
} else {
|
292 |
} else {
|
286 |
// In child process. Set up pipes, environment, and exec command
|
293 |
// In child process. Set up pipes, environment, and exec command
|
287 |
|
294 |
|