diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-05-13 11:39:30 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-05-13 11:39:30 +0200 |
commit | 8fd54c107a01f98cf9c731104b0d3eaa2b85bfa4 (patch) | |
tree | a1e4bbd36f7686e94e108cb3cedf5f16c7ae2872 /shell/source | |
parent | b3ddc791546784bab602f678d07ac3538b034b4d (diff) |
Related fdo#60338: Do not use umask(3) in a MT program
Change-Id: Ie515201e44ad58faf623a04981e891c0b3f4a19d
Diffstat (limited to 'shell/source')
-rw-r--r-- | shell/source/unix/sysshell/recently_used_file.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/shell/source/unix/sysshell/recently_used_file.cxx b/shell/source/unix/sysshell/recently_used_file.cxx index 2bce26c8b972..2189d0bce12e 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_) |