mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: fix usage with directories containing '.o'
@ 2004-03-05 22:56 Sam Ravnborg
  0 siblings, 0 replies; only message in thread
From: Sam Ravnborg @ 2004-03-05 22:56 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel, Daniel Mack

From: Daniel Mack <daniel@zonque.org>, me

modpost unconditionally searched for ".o" assuming this is always
the suffix of the module. This fails in two cases:
a) when building external modules where any
   directory include ".o" in the name.
   One example is a directory named: .../cvs.alsa.org/...
b) when someone names a kernel directory so it contains ".o".
   One example is drivers/scsi/aic.ok/...

case b) was triggered by renaming the directory for aic7xxx, and
modifying Makefile and Kconfig. This caused make modules to fail.

	Sam

kbuild-fix-modpost.patch:
===== scripts/modpost.c 1.19 vs edited =====
--- 1.19/scripts/modpost.c	Fri Feb 27 06:33:07 2004
+++ edited/scripts/modpost.c	Fri Mar  5 23:42:26 2004
@@ -64,17 +64,20 @@
 {
 	struct module *mod;
 	char *p;
+	size_t len;
 	
 	mod = NOFAIL(malloc(sizeof(*mod)));
 	memset(mod, 0, sizeof(*mod));
-	mod->name = NOFAIL(strdup(modname));
+	p = NOFAIL(strdup(modname));
 
-	/* strip trailing .o */
-	p = strstr(mod->name, ".o");
-	if (p)
-		*p = 0;
+	len = strlen(p);
 
+	/* strip trailing .o */
+	if (len > 2 && p[len-2] == '.' && p[len-1] == 'o')
+		p[len -2] = '\0';
+	
 	/* add to list */
+	mod->name = NOFAIL(strdup(p));	
 	mod->next = modules;
 	modules = mod;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-05 22:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-05 22:56 [PATCH] kbuild: fix usage with directories containing '.o' Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®