c++ - System() call returns 255, but executes afterwards -
i running mongoose 3.7 server on qnx system.
i receive http request upgrade firmware. on request, use, system()
call in request handler upgrade firmware.
but, strangely, system()
returns 255. same call working before mongoose 2.0.
even more strange, command issued through system()
call works after returned 255.
i using wexitstatus
know error system()
returns
any idea why happening?
i found issue..
the issue mongoose call thread issues system() command not wait return status becuase of line:
on mg_start() function, starts server thread, have included line:
mg_start()
line no 5159:
(void) signal(sigchld, sig_ign);
they have done inorder not create zombie process.
ref: http://www.win.tue.nl/~aeb/linux/lk/lk-5.html
but, according qnx documentation,
“setting signal action
sig_ign
signal that's pending causes pending signal discarded, whether or not blocked. if process sets actionsigchld
signalsig_ign
, behavior unspecified.”
calling sig_ign
on sigchld
causes parent process ignore status signal child.
when make system()
call, blocks sigchld signal shell being launched. according unix documentation:
“blocking
sigchld
while waiting child terminate prevents application catching signal , obtaining status system()'s child process beforesystem()
can status itself.”
but, since mongoose discards signal, not wait signal system()
@ all.
it continues serve response without valid return status system()
.
i commented out line time being. , it’s working.
Comments
Post a Comment