[MPlayer-dev-eng] Check for fork

Jie Zhang jie.zhang at analog.com
Thu Jun 4 14:59:25 CEST 2009


Reimar Döffinger wrote:
> On Thu, Jun 04, 2009 at 06:17:12PM +0800, Jie Zhang wrote:
>> Index: mplayer.c
>> ===================================================================
>> --- mplayer.c	(revision 29347)
>> +++ mplayer.c	(working copy)
>> @@ -803,6 +803,7 @@ static void exit_sighandler(int x){
>>        mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGCRASH);
>>  #ifdef CONFIG_CRASH_DEBUG
>>        if (crash_debug) {
>> +#ifdef HAVE_FORK
>>          int gdb_pid;
>>          mp_msg(MSGT_CPLAYER, MSGL_INFO, "Forking...\n");
>>          gdb_pid = fork();
>> @@ -818,6 +819,9 @@ static void exit_sighandler(int x){
>>          else {
>>            waitpid(gdb_pid, NULL, 0);
>>          }
>> +#else
>> +	mp_msg(MSGT_CPLAYER, MSGL_ERR, "There is no fork\n");
>> +#endif
>>          if (x == SIGTRAP) return;
>>        }
>>  #endif
> 
> IMO you should error out in configure instead if someone tries to enable
> crash-debug and fork is not available.
> 
Yeah, I think this is a better idea.

>> Index: command.c
>> ===================================================================
>> --- command.c	(revision 29347)
>> +++ command.c	(working copy)
>> @@ -3129,7 +3129,7 @@ int run_command(MPContext * mpctx, mp_cm
>>  	    break;
>>  
>>  	case MP_CMD_RUN:
>> -#ifndef __MINGW32__
>> +#if !defined(__MINGW32__) && defined(HAVE_FORK)
>>  	    if (!fork()) {
>>  		execl("/bin/sh", "sh", "-c", cmd->args[0].v.s, NULL);
>>  		exit(0);
> 
> Not related to your patch, but that should probably print an error when
> fork is not available...

Thanks for your comments. How about the attached patch, which has 
addressed both of your comments?


Jie

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer-check-fork-2.diff
Type: text/x-patch
Size: 1721 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090604/4eced1a8/attachment.bin>


More information about the MPlayer-dev-eng mailing list