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