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:
parent
0b5b2f9906
commit
c3b9448cf7
@ -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)
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|||||||
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
|
||||||
|
6
log.c
6
log.c
@ -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)
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user