diff options
author | Mike Gilbert <floppym@gentoo.org> | 2019-05-09 09:41:30 -0400 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2019-05-09 09:41:30 -0400 |
commit | eb1d80e6a30d09f9f139877c5b754c8a8e918d7a (patch) | |
tree | 555246b9f372043993a7a9365e370801d6c52b89 /sys-apps | |
parent | app-emulation/virtualbox: Minor ebuild improvements (diff) | |
download | gentoo-eb1d80e6a30d09f9f139877c5b754c8a8e918d7a.tar.gz gentoo-eb1d80e6a30d09f9f139877c5b754c8a8e918d7a.tar.bz2 gentoo-eb1d80e6a30d09f9f139877c5b754c8a8e918d7a.zip |
sys-apps/systemd: backport patch to fix dracut boot
Closes: https://bugs.gentoo.org/685002
Package-Manager: Portage-2.3.66_p2, Repoman-2.3.12_p111
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/systemd/files/242-socket-util-flush-accept.patch | 46 | ||||
-rw-r--r-- | sys-apps/systemd/systemd-242-r1.ebuild (renamed from sys-apps/systemd/systemd-242.ebuild) | 1 |
2 files changed, 47 insertions, 0 deletions
diff --git a/sys-apps/systemd/files/242-socket-util-flush-accept.patch b/sys-apps/systemd/files/242-socket-util-flush-accept.patch new file mode 100644 index 000000000000..4849c4c0789e --- /dev/null +++ b/sys-apps/systemd/files/242-socket-util-flush-accept.patch @@ -0,0 +1,46 @@ +From f3d75364fbebf2ddb6393e54db5e10b6f6234e14 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering <lennart@poettering.net> +Date: Thu, 18 Apr 2019 15:13:54 +0200 +Subject: [PATCH] socket-util: make sure flush_accept() doesn't hang on + unexpected EOPNOTSUPP + +So apparently there are two reasons why accept() can return EOPNOTSUPP: +because the socket is not a listening stream socket (or similar), or +because the incoming TCP connection for some reason wasn't acceptable to +the host. THe latter should be a transient error, as suggested on +accept(2). The former however should be considered fatal for +flush_accept(). Let's fix this by explicitly checking whether the socket +is a listening socket beforehand. +--- + src/basic/socket-util.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c +index 904bafb76f9..e787d53d8f4 100644 +--- a/src/basic/socket-util.c ++++ b/src/basic/socket-util.c +@@ -1225,9 +1225,22 @@ int flush_accept(int fd) { + .fd = fd, + .events = POLLIN, + }; +- int r; ++ int r, b; ++ socklen_t l = sizeof(b); ++ ++ /* Similar to flush_fd() but flushes all incoming connection by accepting them and immediately ++ * closing them. */ ++ ++ if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &b, &l) < 0) ++ return -errno; + +- /* Similar to flush_fd() but flushes all incoming connection by accepting them and immediately closing them. */ ++ assert(l == sizeof(b)); ++ if (!b) /* Let's check if this is a socket accepting connections before calling accept(). That's ++ * because accept4() can return EOPNOTSUPP in the fd we are called on is not a listening ++ * socket, or in case the incoming TCP connection transiently triggered that (see accept(2) ++ * man page for details). The latter case is a transient error we should continue looping ++ * on. The former case however is fatal. */ ++ return -ENOTTY; + + for (;;) { + int cfd; diff --git a/sys-apps/systemd/systemd-242.ebuild b/sys-apps/systemd/systemd-242-r1.ebuild index d09494587fc5..a26267273852 100644 --- a/sys-apps/systemd/systemd-242.ebuild +++ b/sys-apps/systemd/systemd-242-r1.ebuild @@ -171,6 +171,7 @@ src_prepare() { # Add local patches here PATCHES+=( "${FILESDIR}"/242-gcc-9.patch + "${FILESDIR}"/242-socket-util-flush-accept.patch ) if ! use vanilla; then |