[PATCH] 2.6 series: fixed strange behaviour of scripts/modpost

From: Daniel Mack
Date: Tue Mar 02 2004 - 09:24:50 EST


Hi,

as I found out this morning, it's impossible to use the build-chain
tool modpost of the 2.6 kernel series from within a directory that
contains the character sequence '.o'. Weird things happen if you
try to do so.

With a directory structure like on my system here, building the
current DVB driver in '/home/daniel/cvs.linuxtv.org/dvb-kernel/build-2.6'
generates a file called '/home/daniel/cvs.linuxtv.mod.c' since modpost
cuts every filename string at the first occurence of '.o'.
Funny enough that obviously nobody ever renamed a kernel tree to
something like 'linux-2.6.2.orig' and tried to remake it afterwards ;)

Here's the patch that fixes it:

--- modpost.orig.c 2004-02-18 04:57:17.000000000 +0100
+++ modpost.c 2004-03-02 14:43:42.000000000 +0100
@@ -63,12 +63,12 @@
new_module(char *modname)
{
struct module *mod;
- char *p;
+ int len;

/* strip trailing .o */
- p = strstr(modname, ".o");
- if (p)
- *p = 0;
+ len = strlen (modname);
+ if (len > 2 && modname[len-2] == '.' && modname[len-1] == 'o')
+ modname[len-2] = 0;

mod = NOFAIL(malloc(sizeof(*mod)));
memset(mod, 0, sizeof(*mod));


Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/