[Libreoffice-commits] core.git: shell/source

Stephan Bergmann sbergman at redhat.com
Tue May 13 02:40:10 PDT 2014


 shell/source/unix/sysshell/recently_used_file.cxx |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

New commits:
commit 8fd54c107a01f98cf9c731104b0d3eaa2b85bfa4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue May 13 11:39:30 2014 +0200

    Related fdo#60338: Do not use umask(3) in a MT program
    
    Change-Id: Ie515201e44ad58faf623a04981e891c0b3f4a19d

diff --git a/shell/source/unix/sysshell/recently_used_file.cxx b/shell/source/unix/sysshell/recently_used_file.cxx
index 2bce26c..2189d0b 100644
--- a/shell/source/unix/sysshell/recently_used_file.cxx
+++ b/shell/source/unix/sysshell/recently_used_file.cxx
@@ -63,13 +63,12 @@ recently_used_file::recently_used_file() :
         OString tmp =
             OUStringToOString(rufn, osl_getThreadTextEncoding());
 
-        file_ = fopen(tmp.getStr(), "r+");
-
-        /* create if not exist */
-        if (NULL == file_) {
-            mode_t umask_ = umask(S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
-            file_ = fopen(tmp.getStr(), "w+");
-            umask(umask_);
+        int fd = open(tmp.getStr(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+        if (fd != -1) {
+            file_ = fdopen(fd, "w+");
+            if (file_ == 0) {
+                close(fd);
+            }
         }
 
         if (NULL == file_)


More information about the Libreoffice-commits mailing list