summaryrefslogtreecommitdiff
path: root/source/a/nvi/patches/nvi-08-tempfile_umask.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/nvi/patches/nvi-08-tempfile_umask.patch')
-rw-r--r--source/a/nvi/patches/nvi-08-tempfile_umask.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/a/nvi/patches/nvi-08-tempfile_umask.patch b/source/a/nvi/patches/nvi-08-tempfile_umask.patch
new file mode 100644
index 00000000..6cebc90f
--- /dev/null
+++ b/source/a/nvi/patches/nvi-08-tempfile_umask.patch
@@ -0,0 +1,31 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 08tempfile_umask.dpatch by <hesso@pool.math.tu-berlin.de>
+##
+## DP: No description.
+
+@DPATCH@
+diff -Naur nvi-1.81.6.orig/common/exf.c nvi-1.81.6/common/exf.c
+--- nvi-1.81.6.orig/common/exf.c 2008-05-01 18:10:45.000000000 +0200
++++ nvi-1.81.6/common/exf.c 2008-05-01 18:13:23.000000000 +0200
+@@ -207,16 +207,21 @@
+ */
+ oname = frp->name;
+ if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) {
++ mode_t orig_umask;
+ if (opts_empty(sp, O_TMP_DIRECTORY, 0))
+ goto err;
++ orig_umask = umask(0);
++ umask(orig_umask & 0177);
+ (void)snprintf(tname, sizeof(tname),
+ "%s/vi.XXXXXX", O_STR(sp, O_TMP_DIRECTORY));
+ if ((fd = mkstemp(tname)) == -1) {
++ umask(orig_umask);
+ msgq(sp, M_SYSERR,
+ "237|Unable to create temporary file");
+ goto err;
+ }
+ (void)close(fd);
++ umask(orig_umask);
+
+ if (frp->name == NULL)
+ F_SET(frp, FR_TMPFILE);