we unlink now socket files, the server creator has to take care of not using existing socket files

This commit is contained in:
Anselm R. Garbe 2006-01-29 03:29:59 +02:00
parent 2d97fc681b
commit 048e3e7c0c
2 changed files with 1 additions and 8 deletions

View File

@ -106,13 +106,6 @@ dummy_error_handler(Display * dpy, XErrorEvent * err)
return 0;
}
static void
exit_cleanup()
{
if(mypid == getpid())
unlink(address);
}
static void
new_item()
{
@ -753,7 +746,6 @@ main(int argc, char *argv[])
root_qid.path = mkqpath(Droot, 0);
mypid = getpid();
atexit(exit_cleanup);
/* default item settings */
new_item();

View File

@ -163,6 +163,7 @@ create_unix_sock(char *file, char **errstr)
strncpy(addr.sun_path, file, sizeof(addr.sun_path));
su_len = sizeof(struct sockaddr) + strlen(addr.sun_path);
unlink(file); /* remove old socket, if any */
if(bind(fd, (struct sockaddr *) &addr, su_len) < 0) {
*errstr = "cannot bind socket";
close(fd);