[vlc-devel] [PATCH] vlc_execve: fix fork() version from segfaulting and also endless loop
Keary Griffin
kearygriffin at gmail.com
Fri Jun 11 03:52:32 CEST 2010
I was trying to work with the vlc_execve function to add some new functionality to the livehttp module, but was having some problems getting it to work.
The only other place I could find it used was in the oldhttp module, in the http-handlers section. I tried using the http-handlers and ended up having the same issues.
The first problem seems to be the vlc_execve tries to free the output buffer (*pp_data) before doing anything. The oldhttp module never initializes *pp_data to anything before calling vlc_execve, so the free() would end up segfaulting. I fixed this by commenting out the free() as I can't find any other code that uses vlc_execve, and so assume the calling convention of oldhttp (in not initializing the pointer to anything) is the correct behavior. Let me know if this is an incorrect assumption and I should fix this by initializing *pp_data inside of the oldhttp module.
The second problem was the function never seemed to return. I'm not really familiar with POSIX polling/processes, so I'm not sure I fixed it the correct way. The problem seemed to be that in the while(!p_object->b_die) loop that does the I/O with the process (writing stdin and saving stdout), there was no exit case and it would stay in the loop forever, even after the process ended. I fixed it by keeping track of when all I/O is finished, and then exiting the loop.
Thanks
Keary
Keary Griffin (1):
vlc_execve: fix fork() version from segfaulting and also endless loop
src/extras/libc.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
More information about the vlc-devel
mailing list