mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kded: refuse to start if service is already registered
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
926345627a
commit
d9281db1f8
1 changed files with 13 additions and 0 deletions
|
@ -40,6 +40,8 @@
|
|||
|
||||
#include <QProcess>
|
||||
#include <QHostInfo>
|
||||
#include <QDBusReply>
|
||||
#include <QDBusConnectionInterface>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -665,6 +667,17 @@ int main(int argc, char *argv[])
|
|||
KDE_signal(SIGTERM, sighandler);
|
||||
KDE_signal(SIGHUP, sighandler);
|
||||
|
||||
QDBusConnection session = QDBusConnection::sessionBus();
|
||||
if (!session.isConnected()) {
|
||||
kWarning() << "No DBUS session-bus found. Check if you have started the DBUS server.";
|
||||
return 1;
|
||||
}
|
||||
QDBusReply<bool> sessionReply = session.interface()->isServiceRegistered("org.kde.kded");
|
||||
if (sessionReply.isValid() && sessionReply.value() == true) {
|
||||
kWarning() << "Another instance of kded4 is already running!";
|
||||
return 2;
|
||||
}
|
||||
|
||||
KConfigGroup cg(config, "General");
|
||||
HostnamePollInterval = cg.readEntry("HostnamePollInterval", 5000);
|
||||
bCheckSycoca = cg.readEntry("CheckSycoca", true);
|
||||
|
|
Loading…
Add table
Reference in a new issue