mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-03 15:23:04 +00:00
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: Ruslan Kuprieiev <kupruser@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
09c3f5d0c7
commit
e2c3ad3791
1 changed files with 7 additions and 0 deletions
7
log.c
7
log.c
|
|
@ -17,6 +17,7 @@
|
|||
#include "util.h"
|
||||
#include "cr_options.h"
|
||||
#include "servicefd.h"
|
||||
#include "security.h"
|
||||
|
||||
#define DEFAULT_LOGFD STDERR_FILENO
|
||||
/* Enable timestamps if verbosity is increased from default */
|
||||
|
|
@ -191,6 +192,12 @@ int write_pidfile(int pid)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (cr_fchown(fd)) {
|
||||
pr_perror("Can't chown pidfile %s", opts.pidfile);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
dprintf(fd, "%d", pid);
|
||||
close(fd);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue