mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 2.6 series: fixed strange behaviour of scripts/modpost
@ 2004-03-02 15:14 Daniel Mack
  0 siblings, 0 replies; only message in thread
From: Daniel Mack @ 2004-03-02 15:14 UTC (permalink / raw)
  To: lkml

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

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

only message in thread, other threads:[~2004-03-02 14:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 15:14 [PATCH] 2.6 series: fixed strange behaviour of scripts/modpost Daniel Mack

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®