linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] depmod: do not output .bin to stdout
@ 2020-03-06  7:59 Lucas De Marchi
  2020-03-06  7:59 ` [PATCH 2/2] depmod: just add .bin suffix to builtin.modinfo Lucas De Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Lucas De Marchi @ 2020-03-06  7:59 UTC (permalink / raw)
  To: linux-modules; +Cc: Yanko Kaneti, gladkov.alexey, Lucas De Marchi

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")
---
 tools/depmod.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-09 21:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06  7:59 [PATCH 1/2] depmod: do not output .bin to stdout Lucas De Marchi
2020-03-06  7:59 ` [PATCH 2/2] depmod: just add .bin suffix to builtin.modinfo Lucas De Marchi
2020-03-06  9:58   ` Alexey Gladkov
2020-03-09 21:46     ` Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).