autofs-5.1.9 - fix timed_read() error return

From: Ian Kent <raven@themaw.net>

When the poll() call in timed_read() returns -1 the function will return -1
instead of a sensible error code.

What we want on poll() returning -1 is ETIMEDOUT if the call is interrupted
and the errno error otherwise.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG      |    1 +
 daemon/spawn.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index c28482277..1386d46a7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -65,6 +65,7 @@
 - refactor umount_subtree_mounts().
 - fix indirect expire's count of remaining mounts.
 - fix leak with non-strict mount fails.
+- fix timed_read() error return.
 
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
diff --git a/daemon/spawn.c b/daemon/spawn.c
index 3d185e9d3..a938d44b5 100644
--- a/daemon/spawn.c
+++ b/daemon/spawn.c
@@ -96,8 +96,10 @@ static int timed_read(int pipe, char *buf, size_t len, int time)
 
 	ret = poll(pfd, 1, timeout);
 	if (ret <= 0) {
-		if (ret == 0)
+		if (ret == 0 || errno == EINTR)
 			ret = -ETIMEDOUT;
+		else
+			ret = -errno;
 		return ret;
 	}
 
