ctl-client: Use EAGAIN instead of ENODATA

The latter is obsolete in POSIX.1-2008.
srht-ci v0.6.1
Andri Yngvason 2023-01-23 22:26:38 +00:00
parent b1c1ade90d
commit e710d47f2e
1 changed files with 4 additions and 4 deletions

View File

@ -223,7 +223,7 @@ static json_t* json_from_buffer(struct ctl_client* self)
{ {
if (self->read_len == 0) { if (self->read_len == 0) {
DEBUG("Read buffer is empty"); DEBUG("Read buffer is empty");
errno = ENODATA; errno = EAGAIN;
return NULL; return NULL;
} }
@ -238,7 +238,7 @@ static json_t* json_from_buffer(struct ctl_client* self)
errno = EMSGSIZE; errno = EMSGSIZE;
} else { } else {
DEBUG("Awaiting more data"); DEBUG("Awaiting more data");
errno = ENODATA; errno = EAGAIN;
} }
} else { } else {
ERROR("Json parsing failed: %s", err.text); 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); json_t* root = json_from_buffer(self);
if (root) if (root)
return root; return root;
if (errno != ENODATA) if (errno != EAGAIN)
return NULL; return NULL;
struct pollfd pfd = { struct pollfd pfd = {
@ -292,7 +292,7 @@ static json_t* read_one_object(struct ctl_client* self, int timeout_ms)
self->read_len += n; self->read_len += n;
root = json_from_buffer(self); root = json_from_buffer(self);
if (!root && errno != ENODATA) if (!root && errno != EAGAIN)
break; break;
} }
return root; return root;