From 3bdf4d6641fb34d1c2f130abddb847169a793afe Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 2 Jul 2019 13:42:53 +0100 Subject: 44480: Don't automatically close externally visible file descroptors. These are descriptors marked FDT_EXTERNAL. Make all sysopen'ed file descriptors FDT_EXTERNAL. Make =(...) call closem() consistent with other substitutions. Document file descriptors are left open. --- Src/Modules/system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Src/Modules/system.c') diff --git a/Src/Modules/system.c b/Src/Modules/system.c index 7a4f4ee13..50de59cf9 100644 --- a/Src/Modules/system.c +++ b/Src/Modules/system.c @@ -316,7 +316,7 @@ bin_sysopen(char *nam, char **args, Options ops, UNUSED(int func)) int o, fd, moved_fd, explicit = -1; mode_t perms = 0666; #if defined(FD_CLOEXEC) && !defined(O_CLOEXEC) - int fdflags; + int fdflags = 0; #endif if (!OPT_ISSET(ops, 'u')) { @@ -396,8 +396,8 @@ bin_sysopen(char *nam, char **args, Options ops, UNUSED(int func)) #endif /* O_CLOEXEC */ fcntl(moved_fd, F_SETFD, FD_CLOEXEC); #endif /* FD_CLOEXEC */ + fdtable[moved_fd] = FDT_EXTERNAL; if (explicit == -1) { - fdtable[moved_fd] = FDT_EXTERNAL; setiparam(fdvar, moved_fd); /* if setting the variable failed, close moved_fd to avoid leak */ if (errflag) -- cgit v1.2.3 From 754fdc6580192e81ecc0628349102308868b4857 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Thu, 6 Feb 2020 13:42:32 -0600 Subject: zsh/system: Fix infinite loop in sysread --- ChangeLog | 3 +++ Src/Modules/system.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Src/Modules/system.c') diff --git a/ChangeLog b/ChangeLog index 0116724b1..5b9ed5271 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2020-02-06 dana + * Roman Perepelitsa: 45382: Src/Modules/system.c: Fix infinite + loop in sysread + * Martin von Wittich: 45388 (tweaked): Completion/Unix/Type/_diff_options: Restore -w completion lost in workers/43351 diff --git a/Src/Modules/system.c b/Src/Modules/system.c index 50de59cf9..fb3d80773 100644 --- a/Src/Modules/system.c +++ b/Src/Modules/system.c @@ -174,7 +174,7 @@ bin_sysread(char *nam, char **args, Options ops, UNUSED(int func)) } while ((ret = select(infd+1, (SELECT_ARG_2_T) &fds, - NULL, NULL,&select_tv)) < 1) { + NULL, NULL,&select_tv)) < 0) { if (errno != EINTR || errflag || retflag || breaks || contflag) break; } -- cgit v1.2.3