diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2010-07-26 14:00:46 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2010-07-26 14:00:46 +0000 |
commit | 278a892888352f717b72dc1af06105cdfcbe63fe (patch) | |
tree | f062b0f743807f274c44e45f9d6742f9d6b93870 | |
parent | efa5e34c6cc67184b6d866921c6ae8d24ebff92d (diff) | |
download | zsh-278a892888352f717b72dc1af06105cdfcbe63fe.tar.gz zsh-278a892888352f717b72dc1af06105cdfcbe63fe.tar.xz zsh-278a892888352f717b72dc1af06105cdfcbe63fe.zip |
28102: use lstat() when checking ignore-parents
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/Zle/computil.c | 15 |
2 files changed, 18 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index f37ba173e..fa3be755e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-07-26 Peter Stephenson <pws@csr.com> + + * 28102: Src/Zle/computil.c: use lstat() when checking + ignore-parents. + 2010-07-19 Frank Terbeck <ft@bewatermyfriend.org> * 28101: Completion/Unix/Command/_tmux: Fix window completion @@ -13418,5 +13423,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5035 $ +* $Revision: 1.5036 $ ***************************************************** diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index 32dd401b3..7c5bc2181 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -4653,6 +4653,15 @@ cf_pats(int dirs, int noopt, LinkList names, char **accept, char *skipped, names, skipped, sdirs, fake); } +/* + * This function looks at device/inode pairs to determine if + * a file is one we should ignore because of its relationship + * to the current or parent directory. + * + * We don't follow symbolic links here, because typically + * a user will not want an explicit link to the current or parent + * directory ignored. + */ static void cf_ignore(char **names, LinkList ign, char *style, char *path) { @@ -4661,14 +4670,14 @@ cf_ignore(char **names, LinkList ign, char *style, char *path) char *n, *c, *e; tpar = !!strstr(style, "parent"); - if ((tpwd = !!strstr(style, "pwd")) && stat(pwd, &est)) + if ((tpwd = !!strstr(style, "pwd")) && lstat(pwd, &est)) tpwd = 0; if (!tpar && !tpwd) return; for (; (n = *names); names++) { - if (!ztat(n, &nst, 0) && S_ISDIR(nst.st_mode)) { + if (!ztat(n, &nst, 1) && S_ISDIR(nst.st_mode)) { if (tpwd && nst.st_dev == est.st_dev && nst.st_ino == est.st_ino) { addlinknode(ign, quotestring(n, NULL, QT_BACKSLASH)); continue; @@ -4684,7 +4693,7 @@ cf_ignore(char **names, LinkList ign, char *style, char *path) } } if (found || ((e = strrchr(c, '/')) && e > c + pl && - !ztat(c, &st, 0) && st.st_dev == nst.st_dev && + !ztat(c, &st, 1) && st.st_dev == nst.st_dev && st.st_ino == nst.st_ino)) addlinknode(ign, quotestring(n, NULL, QT_BACKSLASH)); } |