summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/server.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-11-24 23:01:51 +0000
committernicm <nicm@openbsd.org>2015-11-24 23:01:51 +0000
commit5c705c3686a55eb2846f8882d962398a66846cbd (patch)
tree3111d6ab6eead22a8347fc330695a3e7bdf0dc54 /usr.bin/tmux/server.c
parentActually show something (even if it not that helpful) if the server (diff)
downloadwireguard-openbsd-5c705c3686a55eb2846f8882d962398a66846cbd.tar.xz
wireguard-openbsd-5c705c3686a55eb2846f8882d962398a66846cbd.zip
Do lock failures slightly better, return a special value so we don't
unlink the wrong thing.
Diffstat (limited to 'usr.bin/tmux/server.c')
-rw-r--r--usr.bin/tmux/server.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index 4ae2fb88bce..953c3621d1c 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.153 2015/11/24 21:52:06 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.154 2015/11/24 23:01:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -195,9 +195,11 @@ server_start(struct event_base *base, int lockfd, char *lockfile)
server_update_socket();
server_client_create(pair[1]);
- unlink(lockfile);
- free(lockfile);
- close(lockfd);
+ if (lockfd >= 0) {
+ unlink(lockfile);
+ free(lockfile);
+ close(lockfd);
+ }
start_cfg();