my own over-optimisation prevents me from making the MKSH__NO_SYMLINK
case as nice as it could be, since part of the “if (0) {” case is jumped into for the first run of the loop… thanks RT
This commit is contained in:
9
misc.c
9
misc.c
@ -30,7 +30,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#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 */
|
/* type bits for unsigned char */
|
||||||
unsigned char chtypes[UCHAR_MAX + 1];
|
unsigned char chtypes[UCHAR_MAX + 1];
|
||||||
@ -1406,9 +1406,9 @@ do_realpath(const char *upath)
|
|||||||
goto notfound;
|
goto notfound;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MKSH__NO_SYMLINK
|
|
||||||
/* check if we encountered a symlink? */
|
/* check if we encountered a symlink? */
|
||||||
if (S_ISLNK(sb.st_mode)) {
|
if (S_ISLNK(sb.st_mode)) {
|
||||||
|
#ifndef MKSH__NO_SYMLINK
|
||||||
/* reached maximum recursion depth? */
|
/* reached maximum recursion depth? */
|
||||||
if (!symlinks--) {
|
if (!symlinks--) {
|
||||||
/* yep, prevent infinite loops */
|
/* yep, prevent infinite loops */
|
||||||
@ -1443,7 +1443,9 @@ do_realpath(const char *upath)
|
|||||||
if (ldest[0] != '/') {
|
if (ldest[0] != '/') {
|
||||||
/* symlink target is a relative path */
|
/* symlink target is a relative path */
|
||||||
xp = Xrestpos(xs, xp, pos);
|
xp = Xrestpos(xs, xp, pos);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
/* symlink target is an absolute path */
|
/* symlink target is an absolute path */
|
||||||
xp = Xstring(xs, xp);
|
xp = Xstring(xs, xp);
|
||||||
beginning_of_a_pathname:
|
beginning_of_a_pathname:
|
||||||
@ -1457,7 +1459,6 @@ do_realpath(const char *upath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* otherwise (no symlink) merely go on */
|
/* otherwise (no symlink) merely go on */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user