diff options
-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) | |||
381 | struct md4_ctx md; | 381 | struct md4_ctx md; |
382 | char *sources, *end, *fname; | 382 | char *sources, *end, *fname; |
383 | const char *basename; | 383 | const char *basename; |
384 | char filelist[strlen(getenv("MODVERDIR")) + strlen("/") + | 384 | char filelist[PATH_MAX + 1]; |
385 | strlen(modname) - strlen(".o") + strlen(".mod") + 1 ]; | 385 | char *modverdir = getenv("MODVERDIR"); |
386 | |||
387 | if (!modverdir) | ||
388 | modverdir = "."; | ||
386 | 389 | ||
387 | /* Source files for module are in .tmp_versions/modname.mod, | 390 | /* Source files for module are in .tmp_versions/modname.mod, |
388 | after the first line. */ | 391 | after the first line. */ |
@@ -390,7 +393,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) | |||
390 | basename = strrchr(modname, '/') + 1; | 393 | basename = strrchr(modname, '/') + 1; |
391 | else | 394 | else |
392 | basename = modname; | 395 | basename = modname; |
393 | sprintf(filelist, "%s/%.*s.mod", getenv("MODVERDIR"), | 396 | sprintf(filelist, "%s/%.*s.mod", modverdir, |
394 | (int) strlen(basename) - 2, basename); | 397 | (int) strlen(basename) - 2, basename); |
395 | 398 | ||
396 | file = grab_file(filelist, &len); | 399 | file = grab_file(filelist, &len); |