Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: xtrace output sets ERRNO to 9 (EBADF)



diff --git a/Src/exec.c b/Src/exec.c
index 1810fca5e..a1059af5e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4336,10 +4336,13 @@ execcmd_exec(Estate state, Execcmd_params eparams,
     }
     }
     if (newxtrerr) {
+    int eno = errno;
     fil = fileno(newxtrerr);
     fclose(newxtrerr);
     xtrerr = oxtrerr;
+    /* Call zclose() to clean up internal tables, ignore EBADF */
     zclose(fil);
+    errno = eno;
     }

     zsfree(STTYval);




Messages sorted by: Reverse Date, Date, Thread, Author