]> mj.ucw.cz Git - libucw.git/commitdiff
Daemon: Removed unnecessary fcntl lock from daemon-control.
authorPavel Charvat <pchar@ucw.cz>
Thu, 9 Oct 2014 10:08:39 +0000 (10:08 +0000)
committerPavel Charvat <pchar@ucw.cz>
Thu, 9 Oct 2014 10:08:39 +0000 (10:08 +0000)
ucw/daemon-ctrl.c

index 1e17dc6e7ab0892b8c8e7dbb0d83390754fc8c1b..a7a196c0c8a7bc2cea5bcaf734a5420a1848f533 100644 (file)
@@ -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;