# HG changeset patch # User Timo Sirainen # Date 1198947574 -7200 # Node ID 04e048fcd6d74209ca098a24581541ad5dae26be # Parent 046d06f52aa620a3088321b819d232cd7e72bfe5 If dotlock file contains pid <= 0, assume it's invalid. diff -r 046d06f52aa6 -r 04e048fcd6d7 src/lib/file-dotlock.c --- a/src/lib/file-dotlock.c Sat Dec 29 18:45:11 2007 +0200 +++ b/src/lib/file-dotlock.c Sat Dec 29 18:59:34 2007 +0200 @@ -88,6 +88,7 @@ char buf[512], *host; int fd; ssize_t ret; + pid_t pid; fd = open(lock_path, O_RDONLY); if (fd == -1) @@ -116,7 +117,10 @@ if (!is_numeric(buf, '\0')) return -1; - return (pid_t)strtoul(buf, NULL, 0); + pid = (pid_t)strtoul(buf, NULL, 0); + if (pid <= 0) + return -1; + return pid; } static bool