projects
/
lcr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed forking, to prevent LCR to run multiple times
[lcr.git]
/
action.cpp
diff --git
a/action.cpp
b/action.cpp
index
1da9103
..
478406d
100644
(file)
--- a/
action.cpp
+++ b/
action.cpp
@@
-1965,7
+1965,7
@@
void EndpointAppPBX::action_execute(void)
int iWaitStatus;
char *command = (char *)"";
char isdn_port[10];
int iWaitStatus;
char *command = (char *)"";
char isdn_port[10];
- char *argv[1
1
]; /* check also number of args below */
+ char *argv[1
2
]; /* check also number of args below */
int i = 0;
/* get script / command */
int i = 0;
/* get script / command */
@@
-1976,9
+1976,11
@@
void EndpointAppPBX::action_execute(void)
end_trace();
return;
}
end_trace();
return;
}
+#if 0
argv[i++] = (char *)"/bin/sh";
argv[i++] = (char *)"-c";
argv[i++] = command;
argv[i++] = (char *)"/bin/sh";
argv[i++] = (char *)"-c";
argv[i++] = command;
+#endif
argv[i++] = command;
if ((rparam = routeparam(e_action, PARAM_PARAM))) {
argv[i++] = rparam->string_value;
argv[i++] = command;
if ((rparam = routeparam(e_action, PARAM_PARAM))) {
argv[i++] = rparam->string_value;
@@
-1989,6
+1991,7
@@
void EndpointAppPBX::action_execute(void)
argv[i++] = e_callerinfo.name;
SPRINT(isdn_port, "%d", e_callerinfo.isdn_port);
argv[i++] = isdn_port;
argv[i++] = e_callerinfo.name;
SPRINT(isdn_port, "%d", e_callerinfo.isdn_port);
argv[i++] = isdn_port;
+ argv[i++] = e_callerinfo.imsi;
argv[i++] = NULL; /* check also number of args above */
switch (pid = fork ()) {
case -1:
argv[i++] = NULL; /* check also number of args above */
switch (pid = fork ()) {
case -1:
@@
-1998,12
+2001,10
@@
void EndpointAppPBX::action_execute(void)
case 0:
/* To be shure there are no zombies created double fork */
if ((pid2 = fork()) == 0) {
case 0:
/* To be shure there are no zombies created double fork */
if ((pid2 = fork()) == 0) {
- execve("/bin/sh", argv, environ);
- }
- else {
- /* Exit immediately and release the waiting parent. The subprocess falls to init because the parent died */
- exit(0);
+ execve(command, argv, environ);
}
}
+ /* Exit immediately and release the waiting parent. The subprocess falls to init because the parent died */
+ exit(0);
break;
default:
trace_header("ACTION execute", DIRECTION_NONE);
break;
default:
trace_header("ACTION execute", DIRECTION_NONE);