From 475d15aaff9d8eaef8574ab4962c83031c375e49 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 28 Jul 2008 23:27:47 +0200 Subject: save/restore errno where applicable --- libdaemon/dpid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libdaemon') 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; -- cgit