about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2020-01-14 19:09:54 +0000
committerDaniel Shahaf <danielsh@apache.org>2020-01-15 19:49:45 +0000
commitfaa476a4ed1750f117d76dd8f99f0fa1849ab539 (patch)
tree2203c3a652037ee7eb6742215e27fb00318dc53e
parent610b4b3028d44d988b4a4d3340e6e41b63fa9825 (diff)
downloadzsh-faa476a4ed1750f117d76dd8f99f0fa1849ab539.tar.gz
zsh-faa476a4ed1750f117d76dd8f99f0fa1849ab539.tar.xz
zsh-faa476a4ed1750f117d76dd8f99f0fa1849ab539.zip
45302: bin_umask(): Queue signals around umask().
Otherwise, a signal handler might create files while the temporary umask
is in effect.
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ca68e2e4b..02825ae36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-15  Daniel Shahaf  <danielsh@apache.org>
+
+	* 45302: Src/builtin.c: bin_umask(): Queue signals around
+	umask().
+
 2020-01-14  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* users/24656: Doc/Zsh/mod_zutil.yo: docs: Add an example of
diff --git a/Src/builtin.c b/Src/builtin.c
index 0ecabf854..aa5767cf1 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -7287,8 +7287,11 @@ bin_umask(char *nam, char **args, Options ops, UNUSED(int func))
     char *s = *args;
 
     /* Get the current umask. */
-    um = umask(0);
+    queue_signals();
+    um = umask(0777);
     umask(um);
+    unqueue_signals();
+
     /* No arguments means to display the current setting. */
     if (!s) {
 	if (OPT_ISSET(ops,'S')) {