summaryrefslogtreecommitdiff
path: root/Src/init.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2022-02-12 20:55:56 +0100
committerAxel Beckert <abe@deuxchevaux.org>2022-02-12 20:55:56 +0100
commita13f7a2b3efc45af0879bebe63bed7641af4b39f (patch)
tree4656cbf81a49b84bdbf10b83fe81bd33cf8a65cc /Src/init.c
parent60187dd3dae5f3e0cb3bd8f9717d3eda47e6f860 (diff)
parent12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff)
downloadzsh-a13f7a2b3efc45af0879bebe63bed7641af4b39f.tar.gz
zsh-a13f7a2b3efc45af0879bebe63bed7641af4b39f.zip
Update upstream source from tag 'upstream/5.8.1'
Update to upstream version '5.8.1' with Debian dir a5d2bf34c355a0e96e2d6d9fba85468f75c5364f
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/Src/init.c b/Src/init.c
index 04a5856ff..99ccc16cf 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1222,7 +1222,7 @@ setupshin(char *runscript)
/*
* Finish setting up SHIN and its relatives.
*/
- bshin = SHIN ? fdopen(SHIN, "r") : stdin;
+ shinbufalloc();
if (isset(SHINSTDIN) && !SHIN && unset(INTERACTIVE)) {
#ifdef _IONBF
setvbuf(stdin, NULL, _IONBF, 0);
@@ -1377,9 +1377,9 @@ init_misc(char *cmd, char *zsh_name)
dosetopt(RESTRICTED, 1, 0, opts);
if (cmd) {
if (SHIN >= 10)
- fclose(bshin);
+ close(SHIN);
SHIN = movefd(open("/dev/null", O_RDONLY | O_NOCTTY));
- bshin = fdopen(SHIN, "r");
+ shinbufreset();
execstring(cmd, 0, 1, "cmdarg");
stopmsg = 1;
zexit((exit_pending || shell_exiting) ? exit_val : lastval, ZEXIT_NORMAL);
@@ -1402,7 +1402,6 @@ source(char *s)
int tempfd = -1, fd, cj;
zlong oldlineno;
int oldshst, osubsh, oloops;
- FILE *obshin;
char *old_scriptname = scriptname, *us;
char *old_scriptfilename = scriptfilename;
unsigned char *ocs;
@@ -1419,7 +1418,6 @@ source(char *s)
/* save the current shell state */
fd = SHIN; /* store the shell input fd */
- obshin = bshin; /* store file handle for buffered shell input */
osubsh = subsh; /* store whether we are in a subshell */
cj = thisjob; /* store our current job number */
oldlineno = lineno; /* store our current lineno */
@@ -1432,7 +1430,7 @@ source(char *s)
if (!prog) {
SHIN = tempfd;
- bshin = fdopen(SHIN, "r");
+ shinbufsave();
}
subsh = 0;
lineno = 1;
@@ -1500,10 +1498,10 @@ source(char *s)
if (prog)
freeeprog(prog);
else {
- fclose(bshin);
+ close(SHIN);
fdtable[SHIN] = FDT_UNUSED;
SHIN = fd; /* the shell input fd */
- bshin = obshin; /* file handle for buffered shell input */
+ shinbufrestore();
}
subsh = osubsh; /* whether we are in a subshell */
thisjob = cj; /* current job number */