From a730fd614ed213ca590ae075ed99feec65522868 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Tue, 13 Jan 2004 20:03:55 +0000 Subject: use OProcess::processPID() --- (limited to 'noncore/net/wellenreiter') diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 702a7cc..d32b362 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp @@ -1,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** @@ -16,6 +16,7 @@ #include "mainwindow.h" #ifdef QWS #include +#include #else #include #endif @@ -23,12 +24,6 @@ #include #include -// ==> OProcess -#include -#include -#include -#include - #include #include #include @@ -77,33 +72,14 @@ int main( int argc, char **argv ) if ( result == QMessageBox::No ) return -1; } - // dhcp check - NOT HERE! This really belongs as a static member to OProcess - // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... - - QString line; - QDir d = QDir( "/proc" ); - QStringList dirs = d.entryList( QDir::Dirs ); - QStringList::Iterator it; - for ( it = dirs.begin(); it != dirs.end(); ++it ) - { - //qDebug( "next entry: %s", (const char*) *it ); - QFile file( "/proc/"+*it+"/cmdline" ); - file.open( IO_ReadOnly ); - if ( !file.isOpen() ) continue; - QTextStream t( &file ); - line = t.readLine(); - //qDebug( "cmdline = %s", (const char*) line ); - if ( line.contains( "dhcp" ) ) break; - } - if ( line.contains( "dhcp" ) ) + if ( OProcess::processPID( "dhcpc" ) ) { - qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" "This can severly limit scanning!\nShould I kill it for you?" ), QMessageBox::Yes, QMessageBox::No ); if ( result == QMessageBox::Yes ) { - if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) + if ( -1 == ::kill( OProcess::processPID( "dhcpc" ), SIGTERM ) ) qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); else killed = true; -- cgit v0.9.0.2