diff options
author | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-02-19 00:49:37 +0100 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-02-19 09:51:22 +0100 |
commit | 41370d3b5ec6401c5cf0df82297ed989c03a64bd (patch) | |
tree | 325c87fdc674e9f53b90e38d36970d9a61265d44 /scripts/mod | |
parent | 9d6e7a709cdb8f43d9a9ac5532b54a3e70415b9b (diff) | |
download | talos-op-linux-41370d3b5ec6401c5cf0df82297ed989c03a64bd.tar.gz talos-op-linux-41370d3b5ec6401c5cf0df82297ed989c03a64bd.zip |
kbuild: do not segfault in modpost if MODVERDIR is not defined
A combination of calling modpost with option -a and MODVERDIR undefined
caused segmentation fault. So provide a default value and accept the
error messages it generates instead.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mod')
-rw-r--r-- | scripts/mod/sumversion.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index 5c0754526a26..8a2875689e4d 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -381,8 +381,11 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) struct md4_ctx md; char *sources, *end, *fname; const char *basename; - char filelist[strlen(getenv("MODVERDIR")) + strlen("/") + - strlen(modname) - strlen(".o") + strlen(".mod") + 1 ]; + char filelist[PATH_MAX + 1]; + char *modverdir = getenv("MODVERDIR"); + + if (!modverdir) + modverdir = "."; /* Source files for module are in .tmp_versions/modname.mod, after the first line. */ @@ -390,7 +393,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) basename = strrchr(modname, '/') + 1; else basename = modname; - sprintf(filelist, "%s/%.*s.mod", getenv("MODVERDIR"), + sprintf(filelist, "%s/%.*s.mod", modverdir, (int) strlen(basename) - 2, basename); file = grab_file(filelist, &len); |