From e710d47f2ef7abfa7856c04b86c33747e31fbaca Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Mon, 23 Jan 2023 22:26:38 +0000 Subject: [PATCH] ctl-client: Use EAGAIN instead of ENODATA The latter is obsolete in POSIX.1-2008. --- src/ctl-client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ctl-client.c b/src/ctl-client.c index d373002..44945a5 100644 --- a/src/ctl-client.c +++ b/src/ctl-client.c @@ -223,7 +223,7 @@ static json_t* json_from_buffer(struct ctl_client* self) { if (self->read_len == 0) { DEBUG("Read buffer is empty"); - errno = ENODATA; + errno = EAGAIN; return NULL; } @@ -238,7 +238,7 @@ static json_t* json_from_buffer(struct ctl_client* self) errno = EMSGSIZE; } else { DEBUG("Awaiting more data"); - errno = ENODATA; + errno = EAGAIN; } } else { ERROR("Json parsing failed: %s", err.text); @@ -252,7 +252,7 @@ static json_t* read_one_object(struct ctl_client* self, int timeout_ms) json_t* root = json_from_buffer(self); if (root) return root; - if (errno != ENODATA) + if (errno != EAGAIN) return NULL; struct pollfd pfd = { @@ -292,7 +292,7 @@ static json_t* read_one_object(struct ctl_client* self, int timeout_ms) self->read_len += n; root = json_from_buffer(self); - if (!root && errno != ENODATA) + if (!root && errno != EAGAIN) break; } return root;