contain: log formatting
This commit is contained in:
parent
fafef711ad
commit
d1151ea4bd
20
contain.cc
20
contain.cc
@ -175,14 +175,14 @@ static bool containMakeFdsCOENaive(nsjconf_t* nsjconf) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (containPassFd(nsjconf, fd)) {
|
if (containPassFd(nsjconf, fd)) {
|
||||||
LOG_D("FD=%d will be passed to the child process", fd);
|
LOG_D("fd=%d will be passed to the child process", fd);
|
||||||
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags & ~(FD_CLOEXEC))) == -1) {
|
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags & ~(FD_CLOEXEC))) == -1) {
|
||||||
PLOG_E("Could not set FD_CLOEXEC for FD=%d", fd);
|
PLOG_E("Could not set FD_CLOEXEC for fd=%d", fd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags | FD_CLOEXEC)) == -1) {
|
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags | FD_CLOEXEC)) == -1) {
|
||||||
PLOG_E("Could not set FD_CLOEXEC for FD=%d", fd);
|
PLOG_E("Could not set FD_CLOEXEC for fd=%d", fd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,21 +228,21 @@ static bool containMakeFdsCOEProc(nsjconf_t* nsjconf) {
|
|||||||
}
|
}
|
||||||
int flags = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD, 0));
|
int flags = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD, 0));
|
||||||
if (flags == -1) {
|
if (flags == -1) {
|
||||||
PLOG_D("fcntl(fd=%xld, F_GETFD, 0)", fd);
|
PLOG_D("fcntl(fd=%d, F_GETFD, 0)", fd);
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (containPassFd(nsjconf, fd)) {
|
if (containPassFd(nsjconf, fd)) {
|
||||||
LOG_D("FD=%d will be passed to the child process", fd);
|
LOG_D("fd=%d will be passed to the child process", fd);
|
||||||
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags & ~(FD_CLOEXEC))) == -1) {
|
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags & ~(FD_CLOEXEC))) == -1) {
|
||||||
PLOG_E("Could not clear FD_CLOEXEC for FD=%d", fd);
|
PLOG_E("Could not clear FD_CLOEXEC for fd=%d", fd);
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_D("FD=%d will be closed before execve()", fd);
|
LOG_D("fd=%d will be closed before execve()", fd);
|
||||||
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags | FD_CLOEXEC)) == -1) {
|
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags | FD_CLOEXEC)) == -1) {
|
||||||
PLOG_E("Could not set FD_CLOEXEC for FD=%d", fd);
|
PLOG_E("Could not set FD_CLOEXEC for fd=%d", fd);
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -265,14 +265,14 @@ static bool containMakeFdsCOE(nsjconf_t* nsjconf) {
|
|||||||
|
|
||||||
bool setupFD(nsjconf_t* nsjconf, int fd_in, int fd_out, int fd_err) {
|
bool setupFD(nsjconf_t* nsjconf, int fd_in, int fd_out, int fd_err) {
|
||||||
if (nsjconf->stderr_to_null) {
|
if (nsjconf->stderr_to_null) {
|
||||||
LOG_D("Redirecting FD=2 (STDERR_FILENO) to /dev/null");
|
LOG_D("Redirecting fd=2 (STDERR_FILENO) to /dev/null");
|
||||||
if ((fd_err = TEMP_FAILURE_RETRY(open("/dev/null", O_RDWR))) == -1) {
|
if ((fd_err = TEMP_FAILURE_RETRY(open("/dev/null", O_RDWR))) == -1) {
|
||||||
PLOG_E("open('/dev/null', O_RDWR");
|
PLOG_E("open('/dev/null', O_RDWR");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nsjconf->is_silent) {
|
if (nsjconf->is_silent) {
|
||||||
LOG_D("Redirecting FD=0/1/2 (STDIN/OUT/ERR_FILENO) to /dev/null");
|
LOG_D("Redirecting fd=0-2 (STDIN/OUT/ERR_FILENO) to /dev/null");
|
||||||
if (TEMP_FAILURE_RETRY(fd_in = fd_out = fd_err = open("/dev/null", O_RDWR)) == -1) {
|
if (TEMP_FAILURE_RETRY(fd_in = fd_out = fd_err = open("/dev/null", O_RDWR)) == -1) {
|
||||||
PLOG_E("open('/dev/null', O_RDWR)");
|
PLOG_E("open('/dev/null', O_RDWR)");
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user