shared/logs-show: Remove unused OUTPUT_FOLLOW

As of the commit aae9a96d4b removing --follow
option in systemctl command, OUTPUT_FOLLOW has never been set anywhere. Let's
remove it.

The condition expression of the if-statement in show_journal() that refers to
OUTPUT_FOLLOW now thus evaluates always to true. Hence, the call of
sd_journal_wait() is in dead code, and the outer infinite for-loop is
meaningless, which we remove as cleanup.

There is no functional change by this commit.
This commit is contained in:
HATAYAMA Daisuke 2020-03-01 06:31:38 +09:00 committed by Yu Watanabe
parent ef62949a23
commit 27f31daf3e
2 changed files with 69 additions and 81 deletions

View file

@ -1180,7 +1180,6 @@ int show_journal(
return log_error_errno(r, "Failed to skip previous: %m");
}
for (;;) {
for (;;) {
usec_t usec;
@ -1198,8 +1197,7 @@ int show_journal(
if (not_before > 0) {
r = sd_journal_get_monotonic_usec(j, &usec, NULL);
/* -ESTALE is returned if the
timestamp is not from this boot */
/* -ESTALE is returned if the timestamp is not from this boot */
if (r == -ESTALE)
continue;
else if (r < 0)
@ -1234,10 +1232,10 @@ int show_journal(
if (r > 0 && not_before < cutoff) {
maybe_print_begin_newline(f, &flags);
/* If we logged *something* and no permission error happened, than we can
* reliably emit the warning about rotation. If we didn't log anything and
* access errors happened, emit hint about permissions. Otherwise, give a
* generic message, since we can't diagnose the issue. */
/* If we logged *something* and no permission error happened, than we can reliably
* emit the warning about rotation. If we didn't log anything and access errors
* happened, emit hint about permissions. Otherwise, give a generic message, since we
* can't diagnose the issue. */
bool noaccess = journal_access_blocked(j);
@ -1253,15 +1251,6 @@ int show_journal(
warn_cutoff = false;
}
if (!(flags & OUTPUT_FOLLOW))
break;
r = sd_journal_wait(j, USEC_INFINITY);
if (r < 0)
return log_error_errno(r, "Failed to wait for journal: %m");
}
return 0;
}

View file

@ -33,15 +33,14 @@ static inline bool OUTPUT_MODE_IS_JSON(OutputMode m) {
typedef enum OutputFlags {
OUTPUT_SHOW_ALL = 1 << 0,
OUTPUT_FOLLOW = 1 << 1,
OUTPUT_WARN_CUTOFF = 1 << 2,
OUTPUT_FULL_WIDTH = 1 << 3,
OUTPUT_COLOR = 1 << 4,
OUTPUT_CATALOG = 1 << 5,
OUTPUT_BEGIN_NEWLINE = 1 << 6,
OUTPUT_UTC = 1 << 7,
OUTPUT_KERNEL_THREADS = 1 << 8,
OUTPUT_NO_HOSTNAME = 1 << 9,
OUTPUT_WARN_CUTOFF = 1 << 1,
OUTPUT_FULL_WIDTH = 1 << 2,
OUTPUT_COLOR = 1 << 3,
OUTPUT_CATALOG = 1 << 4,
OUTPUT_BEGIN_NEWLINE = 1 << 5,
OUTPUT_UTC = 1 << 6,
OUTPUT_KERNEL_THREADS = 1 << 7,
OUTPUT_NO_HOSTNAME = 1 << 8,
} OutputFlags;
JsonFormatFlags output_mode_to_json_format_flags(OutputMode m);