Merge pull request #9068 from poettering/nspawn-pty-deadlock

nspawn logging deadlock fix
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-05-24 16:25:22 +02:00
committed by GitHub
3 changed files with 30 additions and 11 deletions
+17
View File
@@ -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;
}
+2
View File
@@ -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,