diff options
author | Jan Klass <kissaki@posteo.de> | 2017-04-29 14:34:01 +0300 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2017-05-20 20:59:13 +0300 |
commit | d8f7800b161f52b2c7b2f5bae1d4c9a48891bb28 (patch) | |
tree | 204b7e552d8dc1e6f37eb80dc4404c11309ce5aa /src/murmur | |
parent | 3399a50b8e1a477b2223be37c63dec9eaeb18da1 (diff) |
Make use of EnvUtils::setenv
Diffstat (limited to 'src/murmur')
-rw-r--r-- | src/murmur/UnixMurmur.cpp | 3 | ||||
-rw-r--r-- | src/murmur/main.cpp | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/murmur/UnixMurmur.cpp b/src/murmur/UnixMurmur.cpp index a3429503f..56da21ea2 100644 --- a/src/murmur/UnixMurmur.cpp +++ b/src/murmur/UnixMurmur.cpp @@ -8,6 +8,7 @@ #include "UnixMurmur.h" #include "Meta.h" +#include "EnvUtils.h" QMutex *LimitTest::qm; QWaitCondition *LimitTest::qw; @@ -274,7 +275,7 @@ void UnixMurmur::setuid() { // QDir::homePath is broken. It only looks at $HOME // instead of getpwuid() so we have to set our home // ourselves - ::setenv("HOME", qPrintable(Meta::mp.qsHome), 1); + EnvUtils::setenv(QLatin1String("HOME"), qPrintable(Meta::mp.qsHome)); } #endif } else if (bRoot) { diff --git a/src/murmur/main.cpp b/src/murmur/main.cpp index 26ac98b2a..fdf5cb487 100644 --- a/src/murmur/main.cpp +++ b/src/murmur/main.cpp @@ -187,7 +187,7 @@ int main(int argc, char **argv) { a.setWindowIcon(icon); #else #ifndef Q_OS_MAC - setenv("AVAHI_COMPAT_NOWARN", "1", 1); + EnvUtils::setenv(QLatin1String("AVAHI_COMPAT_NOWARN"), QLatin1String("1")); #endif QCoreApplication a(argc, argv); UnixMurmur unixhandler; @@ -215,9 +215,7 @@ int main(int argc, char **argv) { qWarning() << "Failed to get PATH. Not adding application directory to PATH. DBus bindings may not work."; } else { QString newPath = QString::fromLatin1("%1;%2").arg(QDir::toNativeSeparators(a.applicationDirPath())).arg(path); - STACKVAR(wchar_t, buffout, newPath.length() + 1); - newPath.toWCharArray(buffout); - if (_wputenv_s(L"PATH", buffout) != 0) { + if (!EnvUtils::setenv(QLatin1String("PATH"), newPath)) { qWarning() << "Failed to set PATH. DBus bindings may not work."; } } |