Browse Source

Closing FCGX socket + unlinking unix socket before bind

Yann Weber 4 years ago
parent
commit
5f5c8043a9
2 changed files with 4 additions and 1 deletions
  1. 1
    1
      src/ipc.c
  2. 3
    0
      src/monitor.c

+ 1
- 1
src/ipc.c View File

210
 			{
210
 			{
211
 				err = errno;
211
 				err = errno;
212
 				pyfcgi_log(LOG_ALERT,
212
 				pyfcgi_log(LOG_ALERT,
213
-					"Unable to destroy %s semaphore (%s) : %s",
213
+					"Unable to unlink %s semaphore (%s) : %s",
214
 					semnames[i], PyFCGI_SEM(i).name,
214
 					semnames[i], PyFCGI_SEM(i).name,
215
 					strerror(err));
215
 					strerror(err));
216
 				res = -1;
216
 				res = -1;

+ 3
- 0
src/monitor.c View File

5
 static void clean_exit(int status)
5
 static void clean_exit(int status)
6
 {
6
 {
7
 	pyfcgi_wd_stop();
7
 	pyfcgi_wd_stop();
8
+	pyfcgi_log(LOG_DEBUG, "Exiting with status %d", status);
8
 	if(pyfcgi_mon.sockserv)
9
 	if(pyfcgi_mon.sockserv)
9
 	{
10
 	{
10
 		if(pyfcgi_mon.sockcli)
11
 		if(pyfcgi_mon.sockcli)
359
 		*protocol = 0;
360
 		*protocol = 0;
360
 		addr_un->sun_family = AF_UNIX;
361
 		addr_un->sun_family = AF_UNIX;
361
 		strncpy(addr_un->sun_path, addr_ptr, UNIX_SOCKPATH_MAX);
362
 		strncpy(addr_un->sun_path, addr_ptr, UNIX_SOCKPATH_MAX);
363
+
364
+		unlink(addr_ptr); // if socket exists delete it
362
 		return 0;
365
 		return 0;
363
 	}
366
 	}
364
 
367
 

Loading…
Cancel
Save