add_definitions(-DXDG_APPS_INSTALL_DIR=${XDG_APPS_INSTALL_DIR})
endif(HAVE_INDICATEQT)
+CHECK_FUNCTION_EXISTS(umask HAVE_UMASK)
+if(HAVE_UMASK)
+ add_definitions(-DHAVE_UMASK)
+endif(HAVE_UMASK)
+
# We need to create a version.gen
# For this, we create our genversion binary and make sure it is run every time.
add_executable(genversion ${CMAKE_SOURCE_DIR}/src/common/genversion.cpp)
# include <termios.h>
#endif /* Q_OS_WIN32 */
-// umask
-#ifndef Q_OS_WIN32
+#ifdef HAVE_UMASK
# include <sys/types.h>
# include <sys/stat.h>
-#endif /* Q_OS_WIN32 */
+#endif /* HAVE_UMASK */
// ==============================
// Custom Events
Core::Core()
: _storage(0)
{
-#ifndef Q_OS_WIN32
+#ifdef HAVE_UMASK
umask(S_IRWXG | S_IRWXO);
-#endif /* Q_OS_WIN32 */
+#endif
_startTime = QDateTime::currentDateTime().toUTC(); // for uptime :)
Quassel::loadTranslation(QLocale::system());
}
bool OidentdConfigGenerator::writeConfig() {
+#ifdef HAVE_UMASK
mode_t prev_umask = umask(S_IXUSR | S_IWGRP | S_IXGRP | S_IWOTH | S_IXOTH); // == 0133, rw-r--r--
+#endif
bool not_open = (!_configFile->isOpen() && !_configFile->open(QIODevice::ReadWrite | QIODevice::Text));
+#ifdef HAVE_UMASK
umask(prev_umask);
+#endif
if (not_open)
return false;
#include <QMutex>
#include <QByteArray>
-#ifndef Q_OS_WIN32
+#ifdef HAVE_UMASK
# include <sys/types.h>
# include <sys/stat.h>
-#endif /* Q_OS_WIN32 */
+#endif /* HAVE_UMASK */
#include "quassel.h"
#include "coreidentity.h"