Are you saying that your C program hangs at waitpid() [line 16] or that the kiosk program determines that your program has hung?
If that is precisely how they call your script then the code at line 7 will return zero sometimes and a valid pid other times, depending on whether the asynchronous start happens before pid() is called. If they then do something like wait on the zero pid then they may perceive your script "hung".
Bookmarks