summaryrefslogtreecommitdiff
path: root/src/shared/logs-show.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-03-09 21:23:53 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-03-09 22:10:54 -0400
commita6dcc7e5924f9c27d3e9c6560a448b02ec28b65f (patch)
tree694aa3c7b5b2f4e61fb8c25d5bd8d1f023cf511e /src/shared/logs-show.c
parentad7bcf526d5ec54838bc9411a0e09a293845a015 (diff)
Introduce loop_read_exact helper
Usually when using loop_read(), we want to read the full buffer. Add a helper that mirrors loop_write(), and returns 0 when full buffer was read, and an error otherwise. Use -ENODATA for the short read, to distinguish it from a read error.
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r--src/shared/logs-show.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 944d6856c..d3ee13988 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -1163,9 +1163,9 @@ static int get_boot_id_for_machine(const char *machine, sd_id128_t *boot_id) {
if (fd < 0)
_exit(EXIT_FAILURE);
- k = loop_read(fd, buf, 36, false);
+ r = loop_read_exact(fd, buf, 36, false);
safe_close(fd);
- if (k != 36)
+ if (k < 0)
_exit(EXIT_FAILURE);
k = send(pair[1], buf, 36, MSG_NOSIGNAL);