Linux SHM server: clean up on exit

develop
Petr Mrázek 2010-03-09 21:53:06 +01:00
parent 62ae8df573
commit f72bb0373d
1 changed files with 10 additions and 1 deletions

@ -184,6 +184,15 @@ void SHM_Destroy ( void )
fd_svlock = 0; fd_svlock = 0;
fd_cllock = 0; fd_cllock = 0;
// destroy lock files
char name[256];
char name2[256];
sprintf(name, "/tmp/DFHack/%d",OS_getPID());
sprintf(name2, "%s/SVlock",name);
unlink(name2);
sprintf(name2, "%s/CLlock",name);
unlink(name2);
rmdir(name);
fprintf(stderr,"dfhack: destroyed shared segment.\n"); fprintf(stderr,"dfhack: destroyed shared segment.\n");
inited = false; inited = false;
} }