sal/osl/unx/file.cxx | 4 ++++
1 file changed, 4 insertions(+)
New commits:
commit c3a4dacfa0aae3cf40aa7b123672c6bc197efe0f
Author: Tomaž Vajngerl <[email protected]>
Date: Mon Jun 19 20:39:19 2017 +0200
tdf#59424 unset open flag O_EXCL if O_CREAT is not set
If O_EXCL is set and O_CREAT is not, then the behaviour is
undefined. See open(3) man page.
Change-Id: If61aaf0a0e46babae7df7e17ffbdcb4c81ab6a3c
Reviewed-on: https://gerrit.libreoffice.org/38978
Reviewed-by: Tor Lillqvist <[email protected]>
Reviewed-by: Tomaž Vajngerl <[email protected]>
Tested-by: Tomaž Vajngerl <[email protected]>
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 7225b9326b6b..6d8aba858d95 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -936,6 +936,10 @@ oslFileError openFilePath(const char *cpFilePath,
oslFileHandle* pHandle, sal_uI
flags = osl_file_adjustLockFlags (cpFilePath, flags);
}
+ // O_EXCL can be set only when O_CREAT is set
+ if (flags & O_EXCL && !(flags & O_CREAT))
+ flags &= ~O_EXCL;
+
/* open the file */
int fd = open_c( cpFilePath, flags, mode );
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits