From 74a921f5554b946aa04025b0753ec46fde64285c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 29 Dec 2015 07:02:55 +0100 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/client.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/client.c b/src/client.c index fb569fd..69f4edd 100644 --- a/src/client.c +++ b/src/client.c @@ -71,11 +71,10 @@ send_command(enum command cmd, size_t n, const char *restrict msg) if (fd == -1) { t (errno != ENOENT); } else { - if (flock(fd, LOCK_EX | LOCK_NB) == -1) { - t (errno != EWOULDBLOCK); - start = 0; - } - flock(fd, LOCK_UN); + if (flock(fd, LOCK_EX | LOCK_NB) == -1) + t (start = 0, errno != EWOULDBLOCK); + else + flock(fd, LOCK_UN); close(fd), fd = -1; } -- cgit v1.2.3-70-g09d2