mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-08 09:14:22 +01:00
Remove old sockets after error.
This commit is contained in:
parent
12f7197adb
commit
38b752c1d8
1
TODO
1
TODO
@ -14,3 +14,4 @@
|
||||
- mouse handling and some other bits elinks needs
|
||||
- scrollback
|
||||
- server doesn't handle SIGTERM anymore...
|
||||
- sleep(1) to wait for server frankly sucks
|
||||
|
11
tmux.c
11
tmux.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.c,v 1.4 2007-08-27 13:53:55 nicm Exp $ */
|
||||
/* $Id: tmux.c,v 1.5 2007-08-28 08:30:36 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -155,6 +155,8 @@ main(int argc, char **argv)
|
||||
xfree(path);
|
||||
|
||||
/* Start server if necessary. */
|
||||
n = 0;
|
||||
restart:
|
||||
if (stat(socket_path, &sb) != 0) {
|
||||
if (errno != ENOENT)
|
||||
err(1, "%s", socket_path);
|
||||
@ -169,8 +171,13 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Connect to server. */
|
||||
if ((server_fd = connect_server()) == -1)
|
||||
if ((server_fd = connect_server()) == -1) {
|
||||
if (errno == ECONNREFUSED && n++ < 5) {
|
||||
unlink(socket_path);
|
||||
goto restart;
|
||||
}
|
||||
errx(1, "couldn't find server");
|
||||
}
|
||||
if ((mode = fcntl(server_fd, F_GETFL)) == -1)
|
||||
err(1, "fcntl");
|
||||
if (fcntl(server_fd, F_SETFL, mode|O_NONBLOCK) == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user