From 17a6d6b5a2caa701815417275724c95851e4bcda Mon Sep 17 00:00:00 2001 From: David McCullough Date: Tue, 15 Feb 2011 23:22:26 +0000 Subject: [PATCH] the attached patch is needed for the recent elf2flt on MinGW builds. The stat() cannot cope with directories ending with the directory separator. Regards Stanislav Meduna --- ld-elf2flt.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ld-elf2flt.c b/ld-elf2flt.c index e4cb073..6b8853e 100644 --- a/ld-elf2flt.c +++ b/ld-elf2flt.c @@ -506,13 +506,15 @@ int main(int argc, char *argv[]) Make bindir point to the bin dir for bin/-foo. Make tooldir point to the bin dir for /bin/foo. */ if (streqn(elf2flt_progname, TARGET_ALIAS)) { - tmp = concat(argv0_dir, "../" TARGET_ALIAS "/bin/", NULL); - if (stat(tmp, &buf) == 0 && S_ISDIR(buf.st_mode)) - tooldir = tmp; + tmp = concat(argv0_dir, "../" TARGET_ALIAS "/bin", NULL); + if (stat(tmp, &buf) == 0 && S_ISDIR(buf.st_mode)) { + tooldir = concat(tmp, "/", NULL); + } } else { - tmp = concat(argv0_dir, "../../bin/", NULL); - if (stat(tmp, &buf) == 0 && S_ISDIR(buf.st_mode)) - bindir = tmp; + tmp = concat(argv0_dir, "../../bin", NULL); + if (stat(tmp, &buf) == 0 && S_ISDIR(buf.st_mode)) { + bindir = concat(tmp, "/", NULL); + } } /* Typically ld-elf2flt is invoked as `ld` which means error -- 2.39.5