2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

pidfile: Don't push opts.pidfile as write_pidfile arg

opts are criu-wide available.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov 2013-11-20 14:26:41 +04:00
parent 0b5b2f9906
commit c3b9448cf7
5 changed files with 7 additions and 7 deletions

View File

@ -987,7 +987,7 @@ static inline int fork_with_pid(struct pstree_item *item)
pid = ret;
ret = write_pidfile(opts.pidfile, pid);
ret = write_pidfile(pid);
if (ret < 0) {
pr_perror("Can't write pidfile");
kill(pid, SIGKILL);

View File

@ -386,7 +386,7 @@ int cr_service(bool daemon_mode)
}
if (opts.pidfile) {
if (write_pidfile(opts.pidfile, getpid()) == -1) {
if (write_pidfile(getpid()) == -1) {
pr_perror("Can't write pidfile");
return -1;
}

View File

@ -19,7 +19,7 @@ extern int vprint_num(char *buf, int blen, int num, char **ps);
extern void print_on_level(unsigned int loglevel, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern int write_pidfile(char *pfname, int pid);
extern int write_pidfile(int pid);
#ifndef LOG_PREFIX
# define LOG_PREFIX

6
log.c
View File

@ -171,13 +171,13 @@ void print_on_level(unsigned int loglevel, const char *format, ...)
va_end(params);
}
int write_pidfile(char *pfname, int pid)
int write_pidfile(int pid)
{
int fd;
fd = open(pfname, O_WRONLY | O_TRUNC | O_CREAT, 0600);
fd = open(opts.pidfile, O_WRONLY | O_TRUNC | O_CREAT, 0600);
if (fd == -1) {
pr_perror("Can't open %s", pfname);
pr_perror("Can't open %s", opts.pidfile);
return -1;
}

View File

@ -277,7 +277,7 @@ int cr_page_server(bool daemon_mode)
}
if (opts.pidfile) {
if (write_pidfile(opts.pidfile, getpid()) == -1) {
if (write_pidfile(getpid()) == -1) {
pr_perror("Can't write pidfile");
return -1;
}