diff options
author | François Andriot <francois.andriot@free.fr> | 2014-10-05 16:39:58 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2014-10-05 16:39:58 +0200 |
commit | 754647ba5a501c4e6d872746a7f69248a752b828 (patch) | |
tree | d804ffe4d32414681467e2e02ea3f903036ac90c /tdeprint | |
parent | 78a66b11ddca8b557df4c73fec99469f78727382 (diff) | |
download | tdelibs-754647ba5a501c4e6d872746a7f69248a752b828.tar.gz tdelibs-754647ba5a501c4e6d872746a7f69248a752b828.zip |
Fix cupsd process detection
Diffstat (limited to 'tdeprint')
-rw-r--r-- | tdeprint/cups/cupsdconf2/cupsddialog.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tdeprint/cups/cupsdconf2/cupsddialog.cpp b/tdeprint/cups/cupsdconf2/cupsddialog.cpp index 22a3b2d54..1800aaae4 100644 --- a/tdeprint/cups/cupsdconf2/cupsddialog.cpp +++ b/tdeprint/cups/cupsdconf2/cupsddialog.cpp @@ -44,6 +44,7 @@ #include <tdeio/passdlg.h> #include <kguiitem.h> #include <kprocess.h> +#include <tqprocess.h> #include <stdlib.h> #include <signal.h> @@ -70,6 +71,18 @@ extern "C" int getServerPid() { +#if defined(__OpenBSD__) + TQProcess *proc = new TQProcess(); + proc->addArgument("pgrep"); + proc->addArgument("cupsd"); + proc->start(); + while (proc->isRunning()); //Wait for process to exit + TQString pidString = proc->readLineStdout(); + bool ok; + int pid = pidString.toInt(&ok); + if (ok) return pid; + return (-1); +#else TQDir dir("/proc",TQString::null,TQDir::Name,TQDir::Dirs); for (uint i=0;i<dir.count();i++) { @@ -88,6 +101,7 @@ int getServerPid() } } return (-1); +#endif } const char* getPassword(const char*) |