diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-03-09 21:23:53 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-03-09 22:10:54 -0400 |
commit | a6dcc7e5924f9c27d3e9c6560a448b02ec28b65f (patch) | |
tree | 694aa3c7b5b2f4e61fb8c25d5bd8d1f023cf511e /src/shared/logs-show.c | |
parent | ad7bcf526d5ec54838bc9411a0e09a293845a015 (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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 944d6856cd..d3ee139880 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); |