diff options
-rw-r--r-- | libdaemon/dpid.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libdaemon/dpid.c b/libdaemon/dpid.c index 4cfba91..c7ec2b0 100644 --- a/libdaemon/dpid.c +++ b/libdaemon/dpid.c @@ -103,6 +103,7 @@ pid_t daemon_pid_file_is_running(void) { } txt[l] = 0; + txt[strcspn(txt, "\r\n")] = 0; errno = 0; lpid = strtol(txt, &e, 10); @@ -111,6 +112,7 @@ pid_t daemon_pid_file_is_running(void) { if (errno != 0 || !e || *e || (long) pid != lpid) { daemon_log(LOG_WARNING, "PID file corrupt, removing. (%s)", fn); unlink(fn); + errno = EINVAL; goto finish; } |