Merge pull request #9068 from poettering/nspawn-pty-deadlock
nspawn logging deadlock fix
This commit is contained in:
@@ -1330,3 +1330,20 @@ int log_emergency_level(void) {
|
||||
|
||||
return getpid_cached() == 1 ? LOG_EMERG : LOG_ERR;
|
||||
}
|
||||
|
||||
int log_dup_console(void) {
|
||||
int copy;
|
||||
|
||||
/* Duplicate the fd we use for fd logging if it's < 3 and use the copy from now on. This call is useful
|
||||
* whenever we want to continue logging through the original fd, but want to rearrange stderr. */
|
||||
|
||||
if (console_fd >= 3)
|
||||
return 0;
|
||||
|
||||
copy = fcntl(console_fd, F_DUPFD_CLOEXEC, 3);
|
||||
if (copy < 0)
|
||||
return -errno;
|
||||
|
||||
console_fd = copy;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -284,6 +284,8 @@ void log_set_open_when_needed(bool b);
|
||||
* stderr, the console or kmsg */
|
||||
void log_set_prohibit_ipc(bool b);
|
||||
|
||||
int log_dup_console(void);
|
||||
|
||||
int log_syntax_internal(
|
||||
const char *unit,
|
||||
int level,
|
||||
|
||||
Reference in New Issue
Block a user