diff --git a/kinfocenter/Modules/base/info_fbsd.cpp b/kinfocenter/Modules/base/info_fbsd.cpp index 3892ef9..7fcfdf2 100644 --- a/kinfocenter/Modules/base/info_fbsd.cpp +++ b/kinfocenter/Modules/base/info_fbsd.cpp @@ -27,6 +27,7 @@ extern "C" { #endif #include +#include #include #include @@ -94,7 +95,7 @@ bool GetInfo_SCSI(QTreeWidget* tree) { list << i18n("SCSI subsystem could not be queried: /sbin/camcontrol could not be found"); new QTreeWidgetItem(tree, list); } - if (GetInfo_ReadfromPipe(tree, "/sbin/camcontrol devlist 2>&1", true)) + if (GetInfo_ReadfromPipe(tree, "/sbin/camcontrol", QStringList() << "devlist", true)) return true; return true; @@ -121,7 +122,7 @@ bool GetInfo_PCI(QTreeWidget* tree) { new QTreeWidgetItem(tree, list); return true; } - if (GetInfo_ReadfromPipe(tree, "/usr/sbin/pciconf -l -v 2>&1", true)) + if (GetInfo_ReadfromPipe(tree, "/usr/sbin/pciconf", QStringList() << "-l" << "-v", true)) return true; return false; diff --git a/kinfocenter/Modules/base/info_hpux.cpp b/kinfocenter/Modules/base/info_hpux.cpp index 69ef7a9..9a7705c 100644 --- a/kinfocenter/Modules/base/info_hpux.cpp +++ b/kinfocenter/Modules/base/info_hpux.cpp @@ -30,6 +30,7 @@ along with this program. If not, see . #include #include #include +#include #include # define INFO_PCI "" // Please, who know it ???? @@ -178,14 +179,14 @@ bool GetInfo_PCI(QTreeWidget* tree) { } bool GetInfo_IO_Ports(QListView *lBox) { - if (GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_1, false)) + if (GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_1, QStringList(), false)) return true; else - return GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_2, false); + return GetInfo_ReadfromPipe(lBox, INFO_IOPORTS_2, QStringList(), false); } bool GetInfo_SCSI(QListView *lBox) { - return GetInfo_ReadfromPipe(lBox, INFO_DEVICES, false); + return GetInfo_ReadfromPipe(lBox, INFO_DEVICES, QStringList(), false); } /* Parts taken from fsusage.c from the Midnight Commander (mc) diff --git a/kinfocenter/Modules/base/info_linux.cpp b/kinfocenter/Modules/base/info_linux.cpp index 0db04a4..1fd5c56 100644 --- a/kinfocenter/Modules/base/info_linux.cpp +++ b/kinfocenter/Modules/base/info_linux.cpp @@ -33,6 +33,7 @@ along with this program. If not, see . #include #include #include +#include #include #include @@ -140,9 +141,12 @@ bool GetInfo_PCI(QTreeWidget* tree) { tree->setSortingEnabled(false); /* try to get the output of the lspci package first */ - if ((num = GetInfo_ReadfromPipe(tree, "lspci -v", true)) || (num = GetInfo_ReadfromPipe(tree, "/sbin/lspci -v", true)) || (num = GetInfo_ReadfromPipe(tree, "/usr/sbin/lspci -v", true)) || (num = GetInfo_ReadfromPipe(tree, "/usr/local/sbin/lspci -v", true)) || (num = GetInfo_ReadfromPipe(tree, - "/usr/bin/lspci -v", true))) - return num; + QStringList lspci; + lspci << "lspci" << "/sbin/lspci" << "/usr/sbin/lspci" << "/usr/local/sbin/lspci" << "/usr/bin/lspci"; + QString p; + foreach(p, lspci) + if (num = GetInfo_ReadfromPipe(tree, p, QStringList() << "-v", true)) + return num; /* if lspci failed, read the contents of /proc/pci */ return GetInfo_ReadfromFile(tree, INFO_PCI, 0); diff --git a/kinfocenter/Modules/base/os_base.h b/kinfocenter/Modules/base/os_base.h index f09202d..35553f8 100644 --- a/kinfocenter/Modules/base/os_base.h +++ b/kinfocenter/Modules/base/os_base.h @@ -320,12 +320,12 @@ static bool GetInfo_XServer_Generic(QTreeWidget *lBox) { } /* Helper-function to read output from an external program */ -static int GetInfo_ReadfromPipe(QTreeWidget* tree, const char *FileName, bool WithEmptyLines = true) { +static int GetInfo_ReadfromPipe(QTreeWidget* tree, const QString &program, const QStringList &arguments, bool WithEmptyLines = true) { QProcess proc; QTreeWidgetItem* olditem= NULL; QString s; - proc.start(FileName, QIODevice::ReadOnly); + proc.start(program, arguments, QIODevice::ReadOnly); if (!proc.waitForFinished()) { // Process hanged or did not start return 0;