Diffstat (limited to 'noncore/net/networksetup/interface.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/networksetup/interface.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/noncore/net/networksetup/interface.cpp b/noncore/net/networksetup/interface.cpp index 5b21364..1f32093 100644 --- a/noncore/net/networksetup/interface.cpp +++ b/noncore/net/networksetup/interface.cpp @@ -3,2 +3,3 @@ #include <qfile.h> +#include <qdir.h> #include <qfileinfo.h> @@ -130,4 +131,9 @@ bool Interface::refresh(){ + QString dhcpDirectory(HDCP_INFO_DIR); + QDir d(dhcpDirectory); + if(!d.exists(dhcpDirectory)) + dhcpDirectory = "/var/run"; + // See if we have - QString dhcpFile(QString(HDCP_INFO_DIR "/dhcpcd-%1.info").arg(interfaceName)); + QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(interfaceName)); // If there is no DHCP information then exit now with no errors. @@ -150,4 +156,4 @@ bool Interface::refresh(){ line = stream.readLine(); - if(line.contains("DHCPSID=")) - dhcpServerIp = line.mid(8, line.length()); + if(line.contains("DHCPSIADDR=")) + dhcpServerIp = line.mid(11, line.length()); if(line.contains("LEASETIME=")) @@ -162,3 +168,3 @@ bool Interface::refresh(){ // Get the pid of the deamond - dhcpFile = (QString(HDCP_INFO_DIR "/dhcpcd-%1.pid").arg(interfaceName)); + dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(interfaceName)); file.setName(dhcpFile); |