From 754647ba5a501c4e6d872746a7f69248a752b828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Andriot?= Date: Sun, 5 Oct 2014 16:39:58 +0200 Subject: Fix cupsd process detection --- tdeprint/cups/cupsdconf2/cupsddialog.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 #include #include +#include #include #include @@ -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