diff options
author | Andrew Morton <akpm@osdl.org> | 2004-03-11 16:16:28 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-03-11 16:16:28 -0800 |
commit | 2e83d38ae4c483813edc544265b39ee5e26f9b88 (patch) | |
tree | 3c60c815026aa3d5f2435d5f596c51d6d398921b /scripts | |
parent | 238a43a0f005e50e466690241b6310ae8d5c2cce (diff) | |
download | history-2e83d38ae4c483813edc544265b39ee5e26f9b88.tar.gz |
[PATCH] kbuild: fix usage with directories containing '.o'
From: Sam Ravnborg <sam@ravnborg.org>
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.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/modpost.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/modpost.c b/scripts/modpost.c index 3ee9b4d507fa03..8b22ce9aac35c4 100644 --- a/scripts/modpost.c +++ b/scripts/modpost.c @@ -64,17 +64,20 @@ new_module(char *modname) { 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)); + + len = strlen(p); /* strip trailing .o */ - p = strstr(mod->name, ".o"); - if (p) - *p = 0; + 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; |