* take possession of the extra space. This should be cheap, since libc doesn't have to move
* the memory for this. */
- qq = realloc(q, bn * size);
+ qq = reallocarray(q, bn, size);
if (_likely_(qq)) {
*p = qq;
*allocated = bn;
a workaround for kernel bug. It was fixed in 5.2-rc5 (c03cd7738a83), backported to 4.19.66
(4340d175b898) and 4.14.138 (feb6b123b7dd). */
r = cg_unified_controller(controller);
- if (r < 0)
+ if (r <= 0)
return r;
- if (r == 0) /* doesn't apply to legacy hierarchy */
- return 0;
return cg_kill_items(controller, path, sig, flags, s, log_kill, userdata, "cgroup.threads");
}
_cleanup_free_ char *word = NULL;
r = extract_first_word(&p, &word, ",", 0);
- if (r == 0)
- return 0;
- if (r < 0)
+ if (r <= 0)
return r;
r = network_set_bridge(context, word, name);
return r;
r = set_put(master->slaves, link);
- if (r < 0)
+ if (r <= 0)
return r;
- if (r == 0)
- return 0;
link_ref(link);
return 0;
else if (streq(word, "norbind"))
flags &= ~MS_REC;
else {
- log_error("Invalid bind mount option: %s", word);
- return -EINVAL;
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Invalid bind mount option: %s",
+ word);
}
}
int r = 0;
fs = mnt_table_find_target(table, path, MNT_ITER_FORWARD);
- if (fs == NULL) {
+ if (!fs) {
log_warning("Could not find '%s' in mount table", path);
goto fallback;
}
class = exit_status_class(i);
log_info("%d: %s%s%s%s",
i, s ?: "-",
- class ? " (" : "", class ?: "", class ? ")" : "");
+ class ? " (" : "", strempty(class), class ? ")" : "");
if (s)
assert_se(exit_status_from_string(s) == i);