kconfig: fix mconf segmentation fault

I have found small bug in mconf, when you run it without any argument it
will sigsegv.

Without patch:
$ scripts/kconfig/mconf
Segmentation fault

With patch:
$ scripts/kconfig/mconf
can't find file (null)

Signed-off-by: Marcin Garski <mgarski@post.pl>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
Marcin Garski 2007-05-05 22:49:00 +02:00 committed by Sam Ravnborg
parent 767e581d75
commit 11de39e2fb
2 changed files with 2 additions and 2 deletions

View File

@ -2264,7 +2264,7 @@ FILE *zconf_fopen(const char *name)
FILE *f; FILE *f;
f = fopen(name, "r"); f = fopen(name, "r");
if (!f && name[0] != '/') { if (!f && name != NULL && name[0] != '/') {
env = getenv(SRCTREE); env = getenv(SRCTREE);
if (env) { if (env) {
sprintf(fullname, "%s/%s", env, name); sprintf(fullname, "%s/%s", env, name);

View File

@ -265,7 +265,7 @@ FILE *zconf_fopen(const char *name)
FILE *f; FILE *f;
f = fopen(name, "r"); f = fopen(name, "r");
if (!f && name[0] != '/') { if (!f && name != NULL && name[0] != '/') {
env = getenv(SRCTREE); env = getenv(SRCTREE);
if (env) { if (env) {
sprintf(fullname, "%s/%s", env, name); sprintf(fullname, "%s/%s", env, name);