diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-04-14 17:10:36 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-04-14 17:10:36 +0200 |
commit | a2eb2267e44580446ecad37e7206e729cfd78155 (patch) | |
tree | 6ea567fa06f1fd261c9e06def84207ba2cab2efb /src/shared/module-util.c | |
parent | basic/log: assert that 0 is not passed as errno, except in test code (diff) | |
download | systemd-a2eb2267e44580446ecad37e7206e729cfd78155.tar.xz systemd-a2eb2267e44580446ecad37e7206e729cfd78155.zip |
shared/module-util: fix errno value passed to log function
If r == 0, no harm done. But if r > 0, this would be interpreted as an
errno value, wrongly.
Diffstat (limited to 'src/shared/module-util.c')
-rw-r--r-- | src/shared/module-util.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/shared/module-util.c b/src/shared/module-util.c index 587e6369fb..1526f59b0a 100644 --- a/src/shared/module-util.c +++ b/src/shared/module-util.c @@ -20,11 +20,10 @@ int module_load_and_warn(struct kmod_ctx *ctx, const char *module, bool verbose) return log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, r, "Failed to look up module alias '%s': %m", module); - if (!modlist) { - log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, r, - "Failed to find module '%s'", module); - return -ENOENT; - } + if (!modlist) + return log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, + SYNTHETIC_ERRNO(ENOENT), + "Failed to find module '%s'", module); kmod_list_foreach(itr, modlist) { _cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL; |