mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-05-20 06:56:05 +02:00
45583/0007: Remove code that is now unreachable.
This commit is contained in:
parent
12347c26ce
commit
dabfd1f1fb
|
@ -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
|
||||
|
|
21
Src/utils.c
21
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)
|
||||
|
|
Loading…
Reference in New Issue