1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

21631: make sure an unmetafied string is passed to ztat to determine file type.

This commit is contained in:
Clint Adams 2005-08-16 00:51:57 +00:00
parent 3073da5dba
commit 3c92ad4b90
2 changed files with 13 additions and 1 deletions

@ -1,3 +1,8 @@
2005-08-16 Clint Adams <clint@zsh.org>
* 21631: Src/Zle/compcore.c: make sure an unmetafied string is
passed to ztat to determine file type.
2005-08-15 Andrey Borzenkov <bor@zsh.org> 2005-08-15 Andrey Borzenkov <bor@zsh.org>
* 21622: Src/Zle/zle_refresh.c: metafy line back before calling * 21622: Src/Zle/zle_refresh.c: metafy line back before calling

@ -2484,16 +2484,23 @@ add_match_data(int alt, char *str, char *orig, Cline line,
if ((flags & CMF_FILE) && orig[0] && orig[strlen(orig) - 1] != '/') { if ((flags & CMF_FILE) && orig[0] && orig[strlen(orig) - 1] != '/') {
struct stat buf; struct stat buf;
char *pb; char *pb;
int blahl;
pb = (char *) zhalloc((cm->prpre ? strlen(cm->prpre) : 0) + pb = (char *) zhalloc((cm->prpre ? strlen(cm->prpre) : 0) +
3 + strlen(orig)); 3 + strlen(orig));
sprintf(pb, "%s%s", (cm->prpre ? cm->prpre : "./"), orig); sprintf(pb, "%s%s", (cm->prpre ? cm->prpre : "./"), orig);
if (!ztat(pb, &buf, 1)) { char *blah = ztrdup(pb);
unmetafy(blah, &blahl);
if (!ztat(blah, &buf, 1)) {
cm->mode = buf.st_mode; cm->mode = buf.st_mode;
if ((cm->modec = file_type(buf.st_mode)) == ' ') if ((cm->modec = file_type(buf.st_mode)) == ' ')
cm->modec = '\0'; cm->modec = '\0';
} }
free(blah);
} }
if ((*compqstack == '\\' && compqstack[1]) || if ((*compqstack == '\\' && compqstack[1]) ||
(autoq && *compqstack && compqstack[1] == '\\')) (autoq && *compqstack && compqstack[1] == '\\'))