summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-16 20:02:26 +0200
committerGitHub <noreply@github.com>2019-07-16 20:02:26 +0200
commit3151b668c23b23d185cac5420b7abf8f5297d678 (patch)
treeb20152aa71c4060de8b3702a08e6fa8d0ba3832e /src/systemctl
parenta483dc92c2ebce9fdc834b257c927df58d02a69b (diff)
parent4252171a94a0c7cb8f9ee180977465dc4fc0ec8e (diff)
downloadsystemd-3151b668c23b23d185cac5420b7abf8f5297d678.tar.gz
Merge pull request #13076 from keszybz/pr/13062
Timer formatting fixes
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 10e372d3a4..3ce3e07bd7 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5033,11 +5033,13 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
return bus_log_parse_error(r);
while ((r = sd_bus_message_read(m, "(stt)", &base, &v, &next_elapse)) > 0) {
- char timespan1[FORMAT_TIMESPAN_MAX], timespan2[FORMAT_TIMESPAN_MAX];
+ char timespan1[FORMAT_TIMESPAN_MAX] = "n/a", timespan2[FORMAT_TIMESPAN_MAX] = "n/a";
- bus_print_property_valuef(name, expected_value, value, "{ %s=%s ; next_elapse=%s }", base,
- format_timespan(timespan1, sizeof(timespan1), v, 0),
- format_timespan(timespan2, sizeof(timespan2), next_elapse, 0));
+ (void) format_timespan(timespan1, sizeof timespan1, v, 0);
+ (void) format_timespan(timespan2, sizeof timespan2, next_elapse, 0);
+
+ bus_print_property_valuef(name, expected_value, value,
+ "{ %s=%s ; next_elapse=%s }", base, timespan1, timespan2);
}
if (r < 0)
return bus_log_parse_error(r);
@@ -5057,10 +5059,11 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
return bus_log_parse_error(r);
while ((r = sd_bus_message_read(m, "(sst)", &base, &spec, &next_elapse)) > 0) {
- char timestamp[FORMAT_TIMESTAMP_MAX];
+ char timestamp[FORMAT_TIMESTAMP_MAX] = "n/a";
- bus_print_property_valuef(name, expected_value, value, "{ %s=%s ; next_elapse=%s }", base, spec,
- format_timestamp(timestamp, sizeof(timestamp), next_elapse));
+ (void) format_timestamp(timestamp, sizeof(timestamp), next_elapse);
+ bus_print_property_valuef(name, expected_value, value,
+ "{ %s=%s ; next_elapse=%s }", base, spec, timestamp);
}
if (r < 0)
return bus_log_parse_error(r);