aboutsummaryrefslogtreecommitdiffstats
path: root/com32/elflink/ldlinux
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-08-07 10:40:12 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-08-07 10:40:12 +0100
commitd1d03dee6bc961b0afd8dfc68fd35772ecded8be (patch)
tree959159a6c09fa536f640256ac743851644a6ec38 /com32/elflink/ldlinux
parent2e512282fd37f7dcb6d33e025e389f11d6d6d42f (diff)
downloadsyslinux-d1d03dee6bc961b0afd8dfc68fd35772ecded8be.tar.gz
syslinux-d1d03dee6bc961b0afd8dfc68fd35772ecded8be.tar.xz
syslinux-d1d03dee6bc961b0afd8dfc68fd35772ecded8be.zip
ldlinux: Use findpath() to lookup filenamessyslinux-5.00-pre7
We should use the same method of opening files as the module code when searching for extensions. In particular, we should search all of PATH. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/elflink/ldlinux')
-rw-r--r--com32/elflink/ldlinux/ldlinux.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index ade161f3..1c261cd5 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -83,19 +83,20 @@ static const char *get_extension(const char *kernel)
for (ext = file_extensions; ext->name; ext++) {
char *str;
int elen = strlen(ext->name);
- int fd;
+ FILE *f;
str = malloc(len + elen + 1);
strncpy(str, kernel, len);
strncpy(str + len, ext->name, elen);
str[len + elen] = '\0';
-
- fd = searchdir(str);
+ f = findpath(str);
free(str);
- if (fd >= 0)
+ if (f) {
+ fclose(f);
return ext->name;
+ }
}
return NULL;