From eab2c99c415cc5ae53bde8c87e6d2e90e77eb482 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 21 Mar 2020 19:12:55 +0000 Subject: [PATCH 7/8] Remove code that is now unreachable. --- Src/utils.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/Src/utils.c b/Src/utils.c index 567df9222..25579ba11 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -910,18 +910,16 @@ slashsplit(char *s) return r; } -/* expands symlinks and .. or . expressions +/* expands .. or . expressions and one level of symlinks * * Puts the result in the global "xbuf" * - * If "full" is true, resolve one level of symlinks only. - * * WARNING: This will segfault on symlink loops (thread: workers/45282) */ /**/ static int -xsymlinks(char *s, int full) +xsymlinks(char *s) { char **pp, **opp; char xbuf2[PATH_MAX*3+1], xbuf3[PATH_MAX*2+1]; @@ -970,7 +968,7 @@ xsymlinks(char *s, int full) } else { ret = 1; metafy(xbuf3, t0, META_NOALLOC); - if (!full) { + { /* * If only one expansion requested, ensure the * full path is in xbuf. @@ -1005,17 +1003,6 @@ xsymlinks(char *s, int full) */ break; } - if (*xbuf3 == '/') { - strcpy(xbuf, ""); - if (xsymlinks(xbuf3 + 1, 1) < 0) - ret = -1; - else - xbuflen = strlen(xbuf); - } else - if (xsymlinks(xbuf3, 1) < 0) - ret = -1; - else - xbuflen = strlen(xbuf); } } freearray(opp); @@ -1053,7 +1040,7 @@ print_if_link(char *s, int all) char xbuflink[PATH_MAX+1]; *xbuf = '\0'; for (;;) { - if (xsymlinks(start, 0) > 0) { + if (xsymlinks(start) > 0) { printf(" -> "); zputs(*xbuf ? xbuf : "/", stdout); if (!*xbuf)