X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Flogs-show.c;h=54179e94c9e5d00611c99858a63808868f957fc5;hb=4ca08d04542ec2830968a450ee27cc90c28f571a;hp=45741f9e9da1dcad1e9cb7794c1caa02679c8fbd;hpb=63c372cb9df3bee01e3bf8cd7f96f336bddda846;p=elogind.git diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 45741f9e9..54179e94c 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -20,9 +20,7 @@ ***/ #include -#include #include -#include #include #include #include @@ -32,8 +30,10 @@ #include "util.h" #include "utf8.h" #include "hashmap.h" -#include "fileio.h" #include "journal-internal.h" +#include "formats-util.h" +#include "process-util.h" +#include "terminal-util.h" /* up to three lines (each up to 100 characters), or 300 characters, whichever is less */ @@ -409,8 +409,8 @@ static int output_verbose( if (r == -ENOENT) log_debug("Source realtime timestamp not found"); else if (r < 0) { - log_full(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_ERR, - "Failed to get source realtime timestamp: %s", strerror(-r)); + log_full_errno(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_ERR, r, + "Failed to get source realtime timestamp: %m"); return r; } else { _cleanup_free_ char *value = NULL; @@ -429,8 +429,8 @@ static int output_verbose( if (r < 0) { r = sd_journal_get_realtime_usec(j, &realtime); if (r < 0) { - log_full(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_ERR, - "Failed to get realtime timestamp: %s", strerror(-r)); + log_full_errno(r == -EADDRNOTAVAIL ? LOG_DEBUG : LOG_ERR, r, + "Failed to get realtime timestamp: %m"); return r; } } @@ -993,7 +993,7 @@ static int show_journal(FILE *f, if (warn_cutoff && line < how_many && not_before > 0) { sd_id128_t boot_id; - usec_t cutoff; + usec_t cutoff = 0; /* Check whether the cutoff line is too early */ @@ -1166,9 +1166,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 (r < 0) _exit(EXIT_FAILURE); k = send(pair[1], buf, 36, MSG_NOSIGNAL);