Commit 95a961b7 authored by Ruslan Kuprieiev's avatar Ruslan Kuprieiev Committed by Pavel Emelyanov

log: don't kill task, if unable to write pidfile

write_pidfile() was taken out from cr-restore.c, where it was supposed to kill
child if unable to create pidfile. Now we're also using it at service/page-server where kill is redundant. So lets take out kill() from write_pidfile() back to cr-restore.
Signed-off-by: 's avatarRuslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 45f39e04
...@@ -966,9 +966,15 @@ static inline int fork_with_pid(struct pstree_item *item) ...@@ -966,9 +966,15 @@ static inline int fork_with_pid(struct pstree_item *item)
item->pid.real = ret; item->pid.real = ret;
if (opts.pidfile && root_item == item) { if (opts.pidfile && root_item == item) {
ret = write_pidfile(opts.pidfile, ret); int pid;
if (ret < 0)
pid = ret;
ret = write_pidfile(opts.pidfile, pid);
if (ret < 0) {
pr_perror("Can't write pidfile"); pr_perror("Can't write pidfile");
kill(pid, SIGKILL);
}
} }
err_unlock: err_unlock:
......
...@@ -199,7 +199,6 @@ int write_pidfile(char *pfname, int pid) ...@@ -199,7 +199,6 @@ int write_pidfile(char *pfname, int pid)
fd = open(pfname, O_WRONLY | O_TRUNC | O_CREAT, 0600); fd = open(pfname, O_WRONLY | O_TRUNC | O_CREAT, 0600);
if (fd == -1) { if (fd == -1) {
pr_perror("Can't open %s", pfname); pr_perror("Can't open %s", pfname);
kill(pid, SIGKILL);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment