about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2022-04-30 11:24:21 -0700
committerBart Schaefer <schaefer@zsh.org>2022-04-30 11:24:21 -0700
commit276020522e91212bed496c2048b1b24b0817218a (patch)
tree733545ce6bdda3eb3acfe4a347ea80f5a87304c1 /Src/Modules
parent079bb602898d623b725327f2ca30621953197060 (diff)
downloadzsh-276020522e91212bed496c2048b1b24b0817218a.tar.gz
zsh-276020522e91212bed496c2048b1b24b0817218a.tar.xz
zsh-276020522e91212bed496c2048b1b24b0817218a.zip
50150: Filenames need unmetafy for printing
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/stat.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index 7c736072b..0df9b35b7 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -503,8 +503,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func))
     if (OPT_ISSET(ops,'f'))
 	nargs = 1;
     else
-	for (aptr = args; *aptr; aptr++)
+	for (aptr = args; *aptr; aptr++) {
+	    unmetafy(*aptr, NULL);
 	    nargs++;
+	}
 
     if (OPT_ISSET(ops,'g')) {
 	flags |= STF_GMT;
@@ -555,8 +557,8 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func))
     for (; OPT_ISSET(ops,'f') || *args; args++) {
 	char outbuf[PATH_MAX + 9]; /* "link   " + link name + NULL */
 	int rval = OPT_ISSET(ops,'f') ? fstat(fd, &statbuf) :
-	    OPT_ISSET(ops,'L') ? lstat(unmeta(*args), &statbuf) :
-	    stat(unmeta(*args), &statbuf);
+	    OPT_ISSET(ops,'L') ? lstat(*args, &statbuf) :
+	    stat(*args, &statbuf);
 	if (rval) {
 	    if (OPT_ISSET(ops,'f'))
 		sprintf(outbuf, "%d", fd);
@@ -571,10 +573,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func))
 
 	if (flags & STF_FILE) {
 	    if (arrnam)
-		*arrptr++ = ztrdup(*args);
+		*arrptr++ = ztrdup_metafy(*args);
 	    else if (hashnam) {
 	    	*hashptr++ = ztrdup(HNAMEKEY);
-		*hashptr++ = ztrdup(*args);
+		*hashptr++ = ztrdup_metafy(*args);
 	    } else
 		printf("%s%s", *args, (flags & STF_PICK) ? " " : ":\n");
 	}