[MPlayer-dev-eng] Check for fork

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Jun 4 14:06:45 CEST 2009


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.

> 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...



More information about the MPlayer-dev-eng mailing list