summaryrefslogtreecommitdiffstats
path: root/libdaemon/dpid.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdaemon/dpid.c')
-rw-r--r--libdaemon/dpid.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libdaemon/dpid.c b/libdaemon/dpid.c
index 145cf50..510e24a 100644
--- a/libdaemon/dpid.c
+++ b/libdaemon/dpid.c
@@ -117,8 +117,10 @@ pid_t daemon_pid_file_is_running(void) {
goto finish;
if ((l = read(fd, txt, sizeof(txt)-1)) < 0) {
+ int saved_errno = errno;
daemon_log(LOG_WARNING, "read(): %s", strerror(errno));
unlink(fn);
+ errno = saved_errno;
goto finish;
}
@@ -152,8 +154,8 @@ finish:
int saved_errno = errno;
if (locked >= 0)
lock_file(fd, 0);
- errno = saved_errno;
close(fd);
+ errno = saved_errno;
}
return ret;