From: Yu Watanabe Date: Sun, 6 Aug 2017 14:34:55 +0000 (+0900) Subject: core: do not ignore returned values X-Git-Tag: v235~264^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=837df140402bd89ccadddd49e86b685512796cce;p=thirdparty%2Fsystemd.git core: do not ignore returned values --- diff --git a/src/core/execute.c b/src/core/execute.c index 56e3aa61ff5..3b10fa13657 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -3524,23 +3524,23 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { if (c->ioprio_set) { _cleanup_free_ char *class_str = NULL; - ioprio_class_to_string_alloc(IOPRIO_PRIO_CLASS(c->ioprio), &class_str); - fprintf(f, - "%sIOSchedulingClass: %s\n" - "%sIOPriority: %i\n", - prefix, strna(class_str), - prefix, (int) IOPRIO_PRIO_DATA(c->ioprio)); + r = ioprio_class_to_string_alloc(IOPRIO_PRIO_CLASS(c->ioprio), &class_str); + if (r >= 0) + fprintf(f, "%sIOSchedulingClass: %s\n", prefix, class_str); + + fprintf(f, "%sIOPriority: %lu\n", prefix, IOPRIO_PRIO_DATA(c->ioprio)); } if (c->cpu_sched_set) { _cleanup_free_ char *policy_str = NULL; - sched_policy_to_string_alloc(c->cpu_sched_policy, &policy_str); + r = sched_policy_to_string_alloc(c->cpu_sched_policy, &policy_str); + if (r >= 0) + fprintf(f, "%sCPUSchedulingPolicy: %s\n", prefix, policy_str); + fprintf(f, - "%sCPUSchedulingPolicy: %s\n" "%sCPUSchedulingPriority: %i\n" "%sCPUSchedulingResetOnFork: %s\n", - prefix, strna(policy_str), prefix, c->cpu_sched_priority, prefix, yes_no(c->cpu_sched_reset_on_fork)); } @@ -3590,14 +3590,13 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { _cleanup_free_ char *fac_str = NULL, *lvl_str = NULL; - log_facility_unshifted_to_string_alloc(c->syslog_priority >> 3, &fac_str); - log_level_to_string_alloc(LOG_PRI(c->syslog_priority), &lvl_str); + r = log_facility_unshifted_to_string_alloc(c->syslog_priority >> 3, &fac_str); + if (r >= 0) + fprintf(f, "%sSyslogFacility: %s\n", prefix, fac_str); - fprintf(f, - "%sSyslogFacility: %s\n" - "%sSyslogLevel: %s\n", - prefix, strna(fac_str), - prefix, strna(lvl_str)); + r = log_level_to_string_alloc(LOG_PRI(c->syslog_priority), &lvl_str); + if (r >= 0) + fprintf(f, "%sSyslogLevel: %s\n", prefix, lvl_str); } if (c->secure_bits)