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> | 2015-12-23 02:22:51 +0100 |
commit | 50c0b04fd4a58309064112cd25ac18ec39f43b6e (patch) | |
tree | b16769b56bc89fa5ebf23ff16ba83ea8bacb6115 /kdeprint/cups | |
parent | 6cbb86f9ae6c4249af3c2e623b9436bae209ab0d (diff) | |
download | tdelibs-50c0b04fd4a58309064112cd25ac18ec39f43b6e.tar.gz tdelibs-50c0b04fd4a58309064112cd25ac18ec39f43b6e.zip |
Fix cupsd process detection
(cherry picked from commit 754647ba5a501c4e6d872746a7f69248a752b828)
Diffstat (limited to 'kdeprint/cups')
-rw-r--r-- | kdeprint/cups/cupsdconf2/cupsddialog.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/kdeprint/cups/cupsdconf2/cupsddialog.cpp b/kdeprint/cups/cupsdconf2/cupsddialog.cpp index fb59986c5..9863a6146 100644 --- a/kdeprint/cups/cupsdconf2/cupsddialog.cpp +++ b/kdeprint/cups/cupsdconf2/cupsddialog.cpp @@ -44,6 +44,7 @@ #include <kio/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*) |