diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-28 16:23:09 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-28 16:23:09 +0100 |
commit | 2ac549c681ec953f0dacb056de51d2e650113578 (patch) | |
tree | 505140d611251a27349ec0e8a7e2f7fcee582d79 /src | |
parent | sat only has one queue (diff) | |
download | sat-2ac549c681ec953f0dacb056de51d2e650113578.tar.gz sat-2ac549c681ec953f0dacb056de51d2e650113578.tar.bz2 sat-2ac549c681ec953f0dacb056de51d2e650113578.tar.xz |
close state file + unlink before closing to avoid race condition
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r-- | src/satd-diminished.c | 3 | ||||
-rw-r--r-- | src/satd.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/satd-diminished.c b/src/satd-diminished.c index 632e29b..48ada56 100644 --- a/src/satd-diminished.c +++ b/src/satd-diminished.c @@ -76,9 +76,10 @@ main(int argc, char *argv[]) shutdown(fd, SHUT_RDWR); close(fd); - close(SOCK_FILENO); unlink(argv[1]); unlink(argv[2]); /* Only on success! */ + close(SOCK_FILENO); + close(STATE_FILENO); return 0; (void) argc; } @@ -273,8 +273,8 @@ fail: perror(argv0); free(path); if (sock >= 0) { - close(sock); unlink(address.sun_path); + close(sock); } if (state >= 0) close(state); |