Commit c3b9448c authored by Pavel Emelyanov's avatar Pavel Emelyanov

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

opts are criu-wide available.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 0b5b2f99
...@@ -987,7 +987,7 @@ static inline int fork_with_pid(struct pstree_item *item) ...@@ -987,7 +987,7 @@ static inline int fork_with_pid(struct pstree_item *item)
pid = ret; pid = ret;
ret = write_pidfile(opts.pidfile, pid); ret = write_pidfile(pid);
if (ret < 0) { if (ret < 0) {
pr_perror("Can't write pidfile"); pr_perror("Can't write pidfile");
kill(pid, SIGKILL); kill(pid, SIGKILL);
......
...@@ -386,7 +386,7 @@ int cr_service(bool daemon_mode) ...@@ -386,7 +386,7 @@ int cr_service(bool daemon_mode)
} }
if (opts.pidfile) { if (opts.pidfile) {
if (write_pidfile(opts.pidfile, getpid()) == -1) { if (write_pidfile(getpid()) == -1) {
pr_perror("Can't write pidfile"); pr_perror("Can't write pidfile");
return -1; return -1;
} }
......
...@@ -19,7 +19,7 @@ extern int vprint_num(char *buf, int blen, int num, char **ps); ...@@ -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, ...) extern void print_on_level(unsigned int loglevel, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3))); __attribute__ ((__format__ (__printf__, 2, 3)));
extern int write_pidfile(char *pfname, int pid); extern int write_pidfile(int pid);
#ifndef LOG_PREFIX #ifndef LOG_PREFIX
# define LOG_PREFIX # define LOG_PREFIX
......
...@@ -171,13 +171,13 @@ void print_on_level(unsigned int loglevel, const char *format, ...) ...@@ -171,13 +171,13 @@ void print_on_level(unsigned int loglevel, const char *format, ...)
va_end(params); va_end(params);
} }
int write_pidfile(char *pfname, int pid) int write_pidfile(int pid)
{ {
int fd; 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) { if (fd == -1) {
pr_perror("Can't open %s", pfname); pr_perror("Can't open %s", opts.pidfile);
return -1; return -1;
} }
......
...@@ -277,7 +277,7 @@ int cr_page_server(bool daemon_mode) ...@@ -277,7 +277,7 @@ int cr_page_server(bool daemon_mode)
} }
if (opts.pidfile) { if (opts.pidfile) {
if (write_pidfile(opts.pidfile, getpid()) == -1) { if (write_pidfile(getpid()) == -1) {
pr_perror("Can't write pidfile"); pr_perror("Can't write pidfile");
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