]> git.sesse.net Git - vlc/commitdiff
Remove pid file on exit.
authorPavlov Konstantin <thresh@videolan.org>
Tue, 6 Feb 2007 15:22:15 +0000 (15:22 +0000)
committerPavlov Konstantin <thresh@videolan.org>
Tue, 6 Feb 2007 15:22:15 +0000 (15:22 +0000)
src/libvlc-common.c

index dcb589e573b82d337b4a05771d1104c491549591..855045bdca4911e82599aa84c891b5779128a56e 100644 (file)
@@ -1004,6 +1004,25 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, vlc_bool_t b_release )
     if( !p_libvlc )
         return VLC_EGENERIC;
 
+#ifndef WIN32
+    char* psz_pidfile = NULL;
+
+    if( config_GetInt( p_libvlc, "daemon" ) )
+    {
+      psz_pidfile = config_GetPsz( p_libvlc, "pidfile" );
+      if( psz_pidfile != NULL )
+      {
+        msg_Dbg( p_libvlc, "removing pid file %s", psz_pidfile );
+        if( unlink( psz_pidfile ) == -1 )
+        {
+          msg_Dbg( p_libvlc, "removing pid file %s: failed: %s",
+              psz_pidfile, strerror(errno) );
+        }
+      }
+      free ( psz_pidfile );
+    }
+#endif
+
     if( p_libvlc->p_memcpy_module )
     {
         module_Unneed( p_libvlc, p_libvlc->p_memcpy_module );