subproc: save/restore errno when printing error message twice

This commit is contained in:
Robert Swiecki 2019-03-12 17:07:24 +01:00
parent 46f463a62c
commit 8059747016
2 changed files with 6 additions and 4 deletions

View File

@ -435,9 +435,11 @@ bool runChild(nsjconf_t* nsjconf, int fd_in, int fd_out, int fd_err) {
close(child_fd);
if (pid == -1) {
if (flags & CLONE_NEWCGROUP) {
auto saved_errno = errno;
PLOG_E(
"nsjail tried to use the CLONE_NEWCGROUP clone flag, which is "
"supported under kernel versions >= 4.6 only. Try disabling this flag");
errno = saved_errno;
}
PLOG_E(
"clone(flags=%s) failed. You probably need root privileges if your system "