remove socket at exit
This commit is contained in:
parent
42c3794c5c
commit
c3e73c01e3
1 changed files with 11 additions and 0 deletions
|
|
@ -156,6 +156,7 @@ int label(Rune*, int);
|
|||
char wdir[1024];
|
||||
char childwdir[1024];
|
||||
void hangupnote(void*, char*);
|
||||
char thesocket[100];
|
||||
|
||||
char *menu2str[] = {
|
||||
"cut",
|
||||
|
|
@ -1844,6 +1845,14 @@ rawon(void)
|
|||
char adir[100];
|
||||
int afd;
|
||||
|
||||
void
|
||||
removethesocket(void)
|
||||
{
|
||||
if(thesocket[0])
|
||||
if(remove(thesocket) < 0)
|
||||
fprint(2, "remove %s: %r\n", thesocket);
|
||||
}
|
||||
|
||||
void
|
||||
servedevtext(void)
|
||||
{
|
||||
|
|
@ -1858,6 +1867,8 @@ servedevtext(void)
|
|||
|
||||
putenv("text9term", buf);
|
||||
threadcreate(listenthread, nil, STACK);
|
||||
strcpy(thesocket, buf+5);
|
||||
atexit(removethesocket);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue