When using full path for a com32 module, for example,
/boot/syslinux/ls.c32 it fails without any error message. This patch
fixes it by looking first if the argv[0] is the path to a module before
looking for it at PATH.
Since we're using fopen to open module files (which works for both
absolute paths and paths relative to the current working directory) we
no longer need to include "." in PATH and neither the code to handle it.
Signed-off-by: Andre Ericson <de.ericson@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
char *p, *n;
int i;
+ f = fopen(name, "rb"); /* for full path */
+ if (f)
+ return f;
+
p = PATH;
again:
i = 0;
if (*p == ':')
p++;
- if (path[0] == '.' && i == 1) {
- if (!core_getcwd(path, sizeof(path))) {
- DBG_PRINT("Could not get cwd\n");
- return NULL;
- }
-
- i = strlen(path);
- }
-
n = name;
while (*n && i < FILENAME_MAX)
path[i++] = *n++;
return handle ? &files[handle-1] : NULL;
}
-#define PATH_DEFAULT ".:/boot/syslinux/:/boot/"
+#define PATH_DEFAULT "/boot/syslinux/:/boot/"
extern char *PATH;
/* fs.c */