summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--Src/utils.c21
2 files changed, 6 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index d3d3e6ac3..aa056bbd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2020-03-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+ * 45583/0007: Src/utils.c: Remove code that is now unreachable.
+
* 45583/0006: Src/utils.c: Don't use xsymlinks() in 'whence -s'.
* 45583/0005: Test/B13whence.ztst: Add a test for bin_whence's
diff --git a/Src/utils.c b/Src/utils.c
index df2ab11a6..98dac6780 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -919,18 +919,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];
@@ -979,7 +977,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.
@@ -1014,17 +1012,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);
@@ -1062,7 +1049,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)