projects
/
NeonServV5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5c0da2d
)
prevent zombie processes on cmd_extscript
author
pk910
<philipp@zoelle1.de>
Fri, 4 Nov 2011 04:05:06 +0000
(
05:05
+0100)
committer
pk910
<philipp@zoelle1.de>
Fri, 4 Nov 2011 04:05:06 +0000
(
05:05
+0100)
src/cmd_neonserv_extscript.c
patch
|
blob
|
history
diff --git
a/src/cmd_neonserv_extscript.c
b/src/cmd_neonserv_extscript.c
index 2d7e0bd80c29e3fa9e625d2e89a41ff665c29794..37d6f9109805a5b0e95b0009440864d061b142c6 100644
(file)
--- a/
src/cmd_neonserv_extscript.c
+++ b/
src/cmd_neonserv_extscript.c
@@
-117,6
+117,9
@@
CMD_BIND(neonserv_cmd_extscript) {
struct ClientSocket *textbot = getTextBot();
pid_t pID = fork();
if (pID == 0) { //We're the child process :D
struct ClientSocket *textbot = getTextBot();
pid_t pID = fork();
if (pID == 0) { //We're the child process :D
+ pID = fork();
+ if(pID < 0) exit(EXIT_FAILURE);
+ if(pID != 0) exit(EXIT_SUCCESS);
char *a;
while (fgets(command, 1024, fp) != NULL) {
if((a = strchr(command, '\n')))
char *a;
while (fgets(command, 1024, fp) != NULL) {
if((a = strchr(command, '\n')))
@@
-127,12
+130,13
@@
CMD_BIND(neonserv_cmd_extscript) {
reply(textbot, user, "%s", command);
}
pclose(fp);
reply(textbot, user, "%s", command);
}
pclose(fp);
- exit(
0
);
+ exit(
EXIT_FAILURE
);
} else if (pID < 0) {
reply(getTextBot(), user, "internal bot error - please contact an administrator!");
pclose(fp);
} else {
//parent bot - continue program
} else if (pID < 0) {
reply(getTextBot(), user, "internal bot error - please contact an administrator!");
pclose(fp);
} else {
//parent bot - continue program
+ wait(NULL);
}
} else {
//error
}
} else {
//error