From 64447e738d5d876365d2959129c1f44c640e5de9 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 5 May 2012 15:10:39 +0000 Subject: [PATCH] =?UTF-8?q?my=20own=20over-optimisation=20prevents=20me=20?= =?UTF-8?q?from=20making=20the=20MKSH=5F=5FNO=5FSYMLINK=20case=20as=20nice?= =?UTF-8?q?=20as=20it=20could=20be,=20since=20part=20of=20the=20=E2=80=9Ci?= =?UTF-8?q?f=20(0)=20{=E2=80=9D=20case=20is=20jumped=20into=20for=20the=20?= =?UTF-8?q?first=20run=20of=20the=20loop=E2=80=A6=20thanks=20RT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- misc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/misc.c b/misc.c index f117530..39f6d58 100644 --- a/misc.c +++ b/misc.c @@ -30,7 +30,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.191 2012/05/04 22:05:02 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.192 2012/05/05 15:10:39 tg Exp $"); /* type bits for unsigned char */ unsigned char chtypes[UCHAR_MAX + 1]; @@ -1406,9 +1406,9 @@ do_realpath(const char *upath) goto notfound; } -#ifndef MKSH__NO_SYMLINK /* check if we encountered a symlink? */ if (S_ISLNK(sb.st_mode)) { +#ifndef MKSH__NO_SYMLINK /* reached maximum recursion depth? */ if (!symlinks--) { /* yep, prevent infinite loops */ @@ -1443,7 +1443,9 @@ do_realpath(const char *upath) if (ldest[0] != '/') { /* symlink target is a relative path */ xp = Xrestpos(xs, xp, pos); - } else { + } else +#endif + { /* symlink target is an absolute path */ xp = Xstring(xs, xp); beginning_of_a_pathname: @@ -1457,7 +1459,6 @@ do_realpath(const char *upath) } } } -#endif /* otherwise (no symlink) merely go on */ }