Changeset 3793e3726479b56b294d7946f0599725dd8f2654

Show
Ignore:
Timestamp:
07/01/06 12:13:13 (2 years ago)
Author:
Pavlov Konstantin <thresh@videolan.org>
git-committer:
Pavlov Konstantin <thresh@videolan.org> 1151748793 +0000
git-parent:

[ff924dbc0fa20c7631c2a07af0a1c36d571a5e71]

git-author:
Pavlov Konstantin <thresh@videolan.org> 1151748793 +0000
Message:

fix indentation and memory leak introduced in 19564.
do not use vlc_t to store psz_pidfile

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/main.h

    rff924db r3793e37  
    9393    char *                 psz_userdir;             /* user's home directory */ 
    9494    char *                 psz_configfile;        /* location of config file */ 
    95     char *                 psz_pidfile; 
    9695 
    9796    /* Fast memcpy plugin used */ 
  • src/libvlc.c

    rff924db r3793e37  
    420420        p_vlc->p_libvlc->b_daemon = VLC_TRUE; 
    421421 
    422         /* lets check if we need to write the pidfile */ 
    423         p_vlc->psz_pidfile = config_GetPsz( p_vlc, "pidfile" ); 
    424  
    425         msg_Dbg( p_vlc, "p_vlc->psz_pidfile is %s", p_vlc->psz_pidfile ); 
    426  
    427         if( p_vlc->psz_pidfile != NULL ) 
    428         { 
    429             pid_t i_pid; 
    430             FILE *pidfile; 
    431              
    432             i_pid = getpid(); 
    433  
    434             msg_Dbg( p_vlc, "our PID is %d, writing it to %s", i_pid, p_vlc->psz_pidfile ); 
    435              
    436             pidfile = utf8_fopen( p_vlc->psz_pidfile,"w" ); 
    437             if( pidfile != NULL ) 
    438             { 
    439                 utf8_fprintf( pidfile, "%d", (int)i_pid ); 
    440                 fclose( pidfile ); 
    441             } 
    442             else 
    443             { 
    444                 msg_Err( p_vlc, "Cannot open pid file for writing: %s, error: %s", p_vlc->psz_pidfile, strerror(errno) ); 
    445             } 
     422        /* lets check if we need to write the pidfile */ 
     423        char * psz_pidfile = config_GetPsz( p_vlc, "pidfile" ); 
     424         
     425        msg_Dbg( p_vlc, "psz_pidfile is %s", psz_pidfile ); 
     426         
     427        if( psz_pidfile != NULL ) 
     428        { 
     429            FILE *pidfile; 
     430            pid_t i_pid = getpid (); 
     431             
     432            msg_Dbg( p_vlc, "our PID is %d, writing it to %s", i_pid, psz_pidfile ); 
     433             
     434            pidfile = utf8_fopen( psz_pidfile,"w" ); 
     435            if( pidfile != NULL ) 
     436            { 
     437                utf8_fprintf( pidfile, "%d", (int)i_pid ); 
     438                fclose( pidfile ); 
     439            } 
     440            else 
     441            { 
     442                msg_Err( p_vlc, "Cannot open pid file for writing: %s, error: %s",  
     443                        psz_pidfile, strerror(errno) ); 
     444            } 
    446445        } 
     446 
     447        free( psz_pidfile ); 
    447448 
    448449#else