summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-11-24 23:01:52 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-11-24 23:01:52 +0000
commit7909957383730ffa59a3a9980192f591d74f113e (patch)
tree4c851c17a4f800f3a9c07a719afe0ff2d31c37d3 /usr.bin/tmux/server.c
parentece356723f63639d26ae8fe9ac66f7c33018ef7e (diff)
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();