summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2020-03-05 13:33:10 -0800
committerLucas De Marchi <lucas.demarchi@intel.com>2020-03-13 09:23:58 -0700
commit53b30aeba2dedae9f5558f560231d9462e063dfc (patch)
treea5c8d1315dbb3c41747ef31d4b48ae39044852bd
parent3c1073e17af877ff27ed7d1906494723f969710e (diff)
downloadkmod-53b30aeba2dedae9f5558f560231d9462e063dfc.tar.gz
kmod-53b30aeba2dedae9f5558f560231d9462e063dfc.tar.bz2
kmod-53b30aeba2dedae9f5558f560231d9462e063dfc.zip
depmod: do not output .bin to stdout
index_write() relies on fseek/ftell to manage the position to which we are write and thus needs the file stream to support it. Right now when trying to write the index to stdout we fail with: depmod: tools/depmod.c:416: index_write: Assertion `initial_offset >= 0' failed. Aborted (core dumped) We have no interest in outputting our index to stdout, so just skip it like is done with other indexes. While at it, add/remove some newlines to improve readability. Reported-by: Yanko Kaneti <yaneti@declera.com> Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo")
-rw-r--r--tools/depmod.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/depmod.c b/tools/depmod.c
index fbbce10..875e314 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -2408,8 +2408,10 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out)
struct index_node *idx;
struct kmod_list *l, *builtin = NULL;
- idx = index_create();
+ if (out == stdout)
+ return 0;
+ idx = index_create();
if (idx == NULL) {
ret = -ENOMEM;
goto fail;
@@ -2456,7 +2458,9 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out)
if (count)
index_write(idx, out);
+
index_destroy(idx);
+
fail:
if (builtin)
kmod_module_unref_list(builtin);