Commit e2c3ad37 authored by Ruslan Kuprieiev's avatar Ruslan Kuprieiev Committed by Pavel Emelyanov

log: chown pidfile to current criu user

If criu run with suid bit set, user should be able
to read pidfiles(i.e. service pidfile).
Signed-off-by: 's avatarRuslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 09c3f5d0
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "util.h" #include "util.h"
#include "cr_options.h" #include "cr_options.h"
#include "servicefd.h" #include "servicefd.h"
#include "security.h"
#define DEFAULT_LOGFD STDERR_FILENO #define DEFAULT_LOGFD STDERR_FILENO
/* Enable timestamps if verbosity is increased from default */ /* Enable timestamps if verbosity is increased from default */
...@@ -191,6 +192,12 @@ int write_pidfile(int pid) ...@@ -191,6 +192,12 @@ int write_pidfile(int pid)
return -1; return -1;
} }
if (cr_fchown(fd)) {
pr_perror("Can't chown pidfile %s", opts.pidfile);
close(fd);
return -1;
}
dprintf(fd, "%d", pid); dprintf(fd, "%d", pid);
close(fd); close(fd);
return 0; return 0;
......
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