about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2013-07-29 10:44:07 +0100
committerPeter Stephenson <pws@zsh.org>2013-07-29 10:44:07 +0100
commit9d32c82da323982610dacc2562b1135dbb2079af (patch)
treefbd8ad6c57e32729c96b4655877cf05d3b713684 /Src/builtin.c
parent5b85ac9011bb5443fc019ad00907c0a16597b21a (diff)
downloadzsh-9d32c82da323982610dacc2562b1135dbb2079af.tar.gz
zsh-9d32c82da323982610dacc2562b1135dbb2079af.tar.xz
zsh-9d32c82da323982610dacc2562b1135dbb2079af.zip
17591: fix error message for invalid fd in print -u
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 8516acd81..ae2e9f676 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3792,11 +3792,11 @@ bin_print(char *name, char **args, Options ops, int func)
 
     /* -u and -p -- output to other than standard output */
     if (OPT_HASARG(ops,'u') || OPT_ISSET(ops,'p')) {
-	int fd;
+	int fdarg, fd;
 
 	if (OPT_ISSET(ops, 'p')) {
-	    fd = coprocout;
-	    if (fd < 0) {
+	    fdarg = coprocout;
+	    if (fdarg < 0) {
 		zwarnnam(name, "-p: no coprocess");
 		return 1;
 	    }
@@ -3804,13 +3804,13 @@ bin_print(char *name, char **args, Options ops, int func)
 	    char *argptr = OPT_ARG(ops,'u'), *eptr;
 	    /* Handle undocumented feature that -up worked */
 	    if (!strcmp(argptr, "p")) {
-		fd = coprocout;
-		if (fd < 0) {
+		fdarg= coprocout;
+		if (fdarg < 0) {
 		    zwarnnam(name, "-p: no coprocess");
 		    return 1;
 		}
 	    } else {
-		fd = (int)zstrtol(argptr, &eptr, 10);
+		fdarg = (int)zstrtol(argptr, &eptr, 10);
 		if (*eptr) {
 		    zwarnnam(name, "number expected after -%c: %s", 'u',
 			     argptr);
@@ -3819,8 +3819,8 @@ bin_print(char *name, char **args, Options ops, int func)
 	    }
 	}
 
-	if ((fd = dup(fd)) < 0) {
-	    zwarnnam(name, "bad file number: %d", fd);
+	if ((fd = dup(fdarg)) < 0) {
+	    zwarnnam(name, "bad file number: %d", fdarg);
 	    return 1;
 	}
 	if ((fout = fdopen(fd, "w")) == 0) {