mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 18:56:25 +00:00
Added code to remove stale unix domain socket files on startup and
shutdown.
This commit is contained in:
parent
9a957dbda7
commit
f43143bd0f
2
dna.c
2
dna.c
@ -305,6 +305,8 @@ void servalShutdownCleanly()
|
||||
unlink(filename);
|
||||
snprintf(filename,1024,"%s/serval.pid",instancepath);
|
||||
unlink(filename);
|
||||
snprintf(filename,1024,"%s/mdp.socket",instancepath);
|
||||
unlink(filename);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,10 @@ int overlay_mdp_setup_sockets()
|
||||
#endif
|
||||
if (mdp_named_socket==-1) {
|
||||
char *instancepath=serval_instancepath();
|
||||
if (strlen(instancepath)>85) return WHY("Instance path too long to allow construction of named unix domain socket.");
|
||||
snprintf(&name.sun_path[0],100,"%s/mdp.socket",instancepath);
|
||||
len = 0+strlen(&name.sun_path[0]) + sizeof(name.sun_family);
|
||||
unlink(&name.sun_path[0]);
|
||||
len = 0+strlen(&name.sun_path[0]) + sizeof(name.sun_family)+1;
|
||||
mdp_named_socket = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||
if (mdp_named_socket>-1) {
|
||||
int dud=0;
|
||||
|
Loading…
Reference in New Issue
Block a user