vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 5ab58f5633010524c6a2c85e87c03c8b79998f5d
parent 2542a602943778f8d70442583a2bfc4d7be23478
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 27 Feb 2017 10:52:38 -0800
Remove unnecessary umask change in text_save_begin_inplace
POSIX says that
The mkstemp() function shall use the resulting pathname to create the
file, and obtain a file descriptor for it, as if by a call to:
open(pathname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR)
So this umask change didn't do anything in practice, unless the original
umask was more restrictive than 0177.
Diffstat:
| M | text.c | | | 2 | -- |
1 file changed, 0 insertions(+), 2 deletions(-)
diff --git a/text.c b/text.c @@ -937,9 +937,7 @@ static bool text_save_begin_inplace(TextSave *ctx) { */ size_t size = txt->block->size; char tmpname[32] = "/tmp/vis-XXXXXX"; - mode_t mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); newfd = mkstemp(tmpname); - umask(mask); if (newfd == -1) goto err; if (unlink(tmpname) == -1)