diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2022-02-15 14:05:13 -0800 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2022-02-20 20:58:11 -0800 |
commit | 9dc4e5ccd4d7ff9ed4e96db8446501a3dc862dbf (patch) | |
tree | 2790f0da0f98db11d92f9b7ca8bbb78cebbde4ce | |
parent | 0246e06340df292b5dda4bc00e24cc9ae894e881 (diff) | |
download | kmod-9dc4e5ccd4d7ff9ed4e96db8446501a3dc862dbf.tar.gz kmod-9dc4e5ccd4d7ff9ed4e96db8446501a3dc862dbf.tar.bz2 kmod-9dc4e5ccd4d7ff9ed4e96db8446501a3dc862dbf.zip |
test-initstate: Check for negative value on error
Documentation says kmod_module_new_from_lookup() returns < 0 on error
and 0 otherwise. There are bugs in libkmod however making it return
a positive value in some situations, that need to be fixed. However
it's best to check for the error explicitly like is done in the rest
of the library to avoid this kind of issues.
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
-rw-r--r-- | testsuite/test-initstate.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/testsuite/test-initstate.c b/testsuite/test-initstate.c index da2303a..9332e8f 100644 --- a/testsuite/test-initstate.c +++ b/testsuite/test-initstate.c @@ -45,7 +45,7 @@ static noreturn int test_initstate_from_lookup(const struct test *t) exit(EXIT_FAILURE); err = kmod_module_new_from_lookup(ctx, "fake-builtin", &list); - if (err != 0) { + if (err < 0) { ERR("could not create module from lookup: %s\n", strerror(-err)); exit(EXIT_FAILURE); } |