backport fix for extending timeouts in initctl

This commit is contained in:
Mattias Walström
2024-06-27 15:43:06 +02:00
parent 4a3559d88f
commit 91c55ddeb8
@@ -0,0 +1,41 @@
From 13b107b7b15e6d4823627ea4707a12108fd5a1c7 Mon Sep 17 00:00:00 2001
From: Joachim Wiberg <troglobit@gmail.com>
Date: Fri, 21 Jun 2024 10:24:35 +0200
Subject: [PATCH] Fix #407: extend initctl poll timeout
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
src/client.c | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/client.c b/src/client.c
index c3fd3aef..a8c06ac4 100644
--- a/src/client.c
+++ b/src/client.c
@@ -29,6 +29,8 @@
#include "client.h"
#include "log.h"
+#define REQUEST_TIMEOUT 15000
+
static int sd = -1;
int client_connect(void)
@@ -85,7 +87,7 @@ int client_request(struct init_request *rq, ssize_t len)
pfd.fd = sd;
pfd.events = POLLOUT;
- if (poll(&pfd, 1, 2000) <= 0) {
+ if (poll(&pfd, 1, REQUEST_TIMEOUT) <= 0) {
warn("Timed out waiting for Finit, errno %d", errno);
return -1;
}
@@ -107,7 +109,7 @@ int client_request(struct init_request *rq, ssize_t len)
pfd.fd = sd;
pfd.events = POLLIN | POLLERR | POLLHUP;
- if ((rc = poll(&pfd, 1, 2000)) <= 0) {
+ if ((rc = poll(&pfd, 1, REQUEST_TIMEOUT)) <= 0) {
if (rc) {
if (errno == EINTR) /* shutdown/reboot */
return -1;