aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-29 07:02:55 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-29 07:02:55 +0100
commit74a921f5554b946aa04025b0753ec46fde64285c (patch)
tree1ed89b9bba6c769376aab6e9785ba03e23be6410
parentstart daemon and send message (diff)
downloadsat-74a921f5554b946aa04025b0753ec46fde64285c.tar.gz
sat-74a921f5554b946aa04025b0753ec46fde64285c.tar.bz2
sat-74a921f5554b946aa04025b0753ec46fde64285c.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
-rw-r--r--src/client.c9
1 files changed, 4 insertions, 5 deletions
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;
}