Changeset 521e2124083b99d24d6b62ddaa53d65c0defe00d

Show
Ignore:
Timestamp:
09/26/04 19:54:56 (4 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1096221296 +0000
git-parent:

[5f631245d55c891b556e7988d5c3a8c8d58723e5]

git-author:
Gildas Bazin <gbazin@videolan.org> 1096221296 +0000
Message:

* src/libvlc.c: use dameon() instead of fork() when available. It does some more things like reopening stdin/out/err to /dev/null which avoids screwing up the first sockets we open.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/libvlc.c

    rf2ab6b6 r521e212  
    77 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
    88 *          Samuel Hocevar <sam@zoy.org> 
    9  *          Gildas Bazin <gbazin@netcourrier.com
     9 *          Gildas Bazin <gbazin@videolan.org
    1010 *          Derk-Jan Hartman <hartman at videolan dot org> 
    1111 * 
     
    353353    if( config_GetInt( p_vlc, "daemon" ) ) 
    354354    { 
    355         pid_t i_pid = 0; 
     355#if HAVE_DAEMON 
     356        if( daemon( 0, 0) != 0 ) 
     357        { 
     358            msg_Err( p_vlc, "Unable to fork vlc to daemon mode" ); 
     359            b_exit = VLC_TRUE; 
     360        } 
     361 
     362        p_vlc->p_libvlc->b_daemon = VLC_TRUE; 
     363 
     364#else 
     365        pid_t i_pid; 
    356366 
    357367        if( ( i_pid = fork() ) < 0 ) 
     
    370380            /* We are the child */ 
    371381            msg_Dbg( p_vlc, "daemon spawned" ); 
    372             close( 0 ); 
    373             close( 1 ); 
    374             close( 2 ); 
     382            close( STDIN_FILENO ); 
     383            close( STDOUT_FILENO ); 
     384            close( STDERR_FILENO ); 
    375385 
    376386            p_vlc->p_libvlc->b_daemon = VLC_TRUE; 
    377387        } 
     388#endif 
    378389    } 
    379390#endif 
  • src/libvlc.h

    r4a18d7b r521e212  
    77 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
    88 *          Samuel Hocevar <sam@zoy.org> 
    9  *          Gildas Bazin <gbazin@netcourrier.com
     9 *          Gildas Bazin <gbazin@videolan.org
    1010 * 
    1111 * This program is free software; you can redistribute it and/or modify 
  • src/vlc.c

    re4ceccd r521e212  
    77 * Authors: Vincent Seguin <seguin@via.ecp.fr> 
    88 *          Samuel Hocevar <sam@zoy.org> 
    9  *          Gildas Bazin <gbazin@netcourrier.com
     9 *          Gildas Bazin <gbazin@videolan.org
    1010 *          Derk-Jan Hartman <hartman at videolan dot org> 
    1111 *          Lots of other people, see the libvlc AUTHORS file 
     
    5252{ 
    5353    int i_ret; 
    54     int b_cli = VLC_FALSE ; 
    5554 
    5655#ifndef SYS_DARWIN 
     
    157156} 
    158157#endif 
    159