aboutsummaryrefslogtreecommitdiffstats
path: root/dln_find.c
diff options
context:
space:
mode:
Diffstat (limited to 'dln_find.c')
-rw-r--r--dln_find.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/dln_find.c b/dln_find.c
index b08612764e..ca62441631 100644
--- a/dln_find.c
+++ b/dln_find.c
@@ -248,26 +248,14 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
/* now append the file name */
i = fnlen;
if (fspace < i) {
- toolong:
- PATHNAME_TOO_LONG();
- goto next;
+ goto toolong;
}
fspace -= i;
memcpy(bp, fname, i + 1);
#if defined(DOSISH)
if (exe_flag && !ext) {
- needs_extension:
- for (j = 0; j < sizeof(extension) / sizeof(extension[0]); j++) {
- if (fspace < strlen(extension[j])) {
- PATHNAME_TOO_LONG();
- continue;
- }
- strlcpy(bp + i, extension[j], fspace);
- if (stat(fbuf, &st) == 0)
- return fbuf;
- }
- goto next;
+ goto needs_extension;
}
#endif
@@ -284,7 +272,25 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
if (*ep == '\0') {
return NULL;
}
+ continue;
+
+ toolong:
+ PATHNAME_TOO_LONG();
+ goto next;
+#if defined(DOSISH)
+ needs_extension:
+ for (j = 0; j < sizeof(extension) / sizeof(extension[0]); j++) {
+ if (fspace < strlen(extension[j])) {
+ PATHNAME_TOO_LONG();
+ continue;
+ }
+ strlcpy(bp + i, extension[j], fspace);
+ if (stat(fbuf, &st) == 0)
+ return fbuf;
+ }
+ goto next;
+#endif
/* otherwise try the next component in the search path */
}
}