From: Darren S. <ds...@us...> - 2004-10-25 19:35:03
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8162/src Modified Files: main.c server.c Log Message: Fix server socket (in /tmp) deletion. Use pid instead of an unreseeded random number. Index: main.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/main.c,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- main.c 17 Jun 2004 08:37:19 -0000 1.91 +++ main.c 25 Oct 2004 19:34:55 -0000 1.92 @@ -128,7 +128,6 @@ server_client_send ("playlist_play (0)\n"); } - server_client_stop (); exit (0); } Index: server.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/server.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- server.c 9 Apr 2004 18:07:52 -0000 1.5 +++ server.c 25 Oct 2004 19:34:55 -0000 1.6 @@ -36,6 +36,7 @@ #include "globals.h" #include "engine.h" +#include "server.h" /* #define LOG @@ -246,7 +247,7 @@ * functions to connect to already running gxine */ -static int client_fd; +static int client_fd = -1; static char tstr[80]; static void sigpipe_handler (int sn) { @@ -278,7 +279,7 @@ memset (&cli_adr, 0, sizeof (cli_adr)); cli_adr.sun_family = AF_UNIX; - sprintf (tstr, "/tmp/gxine_%d", rand()); + sprintf (tstr, "/tmp/gxine_%d", getpid ()); strcpy (cli_adr.sun_path, tstr); unlink (tstr); @@ -287,6 +288,7 @@ perror ("bind"); return 0; } + atexit (server_client_stop); /* initialize the server address structure */ memset(&serv_adr, 0, sizeof(serv_adr)); @@ -312,7 +314,10 @@ void server_client_stop (void) { - close(client_fd); + if (client_fd < 0) + return; + close(client_fd); + client_fd = -1; unlink (tstr); } |