From b4242e37d38fee964f5f86291094336d6aa03c03 Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Thu, 9 Oct 2014 10:08:39 +0000 Subject: [PATCH] Daemon: Removed unnecessary fcntl lock from daemon-control. --- ucw/daemon-ctrl.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ucw/daemon-ctrl.c b/ucw/daemon-ctrl.c index 1e17dc6e..a7a196c0 100644 --- a/ucw/daemon-ctrl.c +++ b/ucw/daemon-ctrl.c @@ -68,13 +68,6 @@ daemon_read_pid(struct daemon_control_params *dc, int will_wait, int *pidp) } } - struct flock fl = { .l_type = F_RDLCK, .l_whence = SEEK_SET }; - while (fcntl(pid_fd, F_SETLKW, &fl) < 0) - { - if (errno != EINTR) - die("Unable to get fcntl lock on '%s': %m", dc->pid_file); - } - char buf[16]; int n = read(pid_fd, buf, sizeof(buf)); if (n < 0) @@ -103,7 +96,7 @@ daemon_read_pid(struct daemon_control_params *dc, int will_wait, int *pidp) int pid; const char *next; - if (str_to_int(&pid, buf, &next, 10) || strcmp(next, "\n")) + if (str_to_int(&pid, buf, &next, 10) || *next != '\n') { daemon_control_err(dc, "PID file `%s' does not contain a valid PID", dc->pid_file); goto fail; -- 2.39.2