summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interface.cpp
authorbenmeyer <benmeyer>2002-10-22 21:04:58 (UTC)
committer benmeyer <benmeyer>2002-10-22 21:04:58 (UTC)
commitc306ba7e1c73ec200b1621d224fc77f45e798e13 (patch) (side-by-side diff)
tree1eb110c64b99c2e6ea2f8ab44c053f1e65f320f3 /noncore/settings/networksettings/interface.cpp
parent1e1b3e398d6b978a9c2bbd85d8f6b7aafbf72b2f (diff)
downloadopie-c306ba7e1c73ec200b1621d224fc77f45e798e13.zip
opie-c306ba7e1c73ec200b1621d224fc77f45e798e13.tar.gz
opie-c306ba7e1c73ec200b1621d224fc77f45e798e13.tar.bz2
Fix segfault
Diffstat (limited to 'noncore/settings/networksettings/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interface.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/networksettings/interface.cpp b/noncore/settings/networksettings/interface.cpp
index a84b91f..929b3a1 100644
--- a/noncore/settings/networksettings/interface.cpp
+++ b/noncore/settings/networksettings/interface.cpp
@@ -1,33 +1,33 @@
#include "interface.h"
#include <qdatetime.h>
#include <qfile.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#define IFCONFIG "/sbin/ifconfig"
-#define HDCP_INFO_DIR "/etc/dhcpc"
+#define DHCP_INFO_DIR "/etc/dhcpc"
#include <stdio.h>
#include <stdlib.h>
Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardwareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){
refresh();
}
/**
* Set status
* @param newStatus - the new status
* emit updateInterface
*/
void Interface::setStatus(bool newStatus){
if(status != newStatus){
status = newStatus;
refresh();
}
};
/**
* Set if attached or not (802.11 card pulled out for example)
* @param isAttached - if attached
* emit updateInterface
@@ -150,49 +150,49 @@ bool Interface::refresh(){
int ipl = line.find("inet addr");
int space = line.find(" ", ipl+10);
ip = line.mid(ipl+10, space-ipl-10);
}
if(line.contains("Mask")){
int mask = line.find("Mask");
subnetMask = line.mid(mask+5, line.length());
}
if(line.contains("Bcast")){
int mask = line.find("Bcast");
int space = line.find(" ", mask+6);
broadcast = line.mid(mask+6, space-mask-6);
}
}
file.close();
QFile::remove(fileName);
// DHCP TESTING
// reset DHCP info
dhcpServerIp = "";
leaseObtained = "";
leaseExpires = "";
dhcp = false;
- QString dhcpDirectory(HDCP_INFO_DIR);
+ QString dhcpDirectory(DHCP_INFO_DIR);
QDir d(dhcpDirectory);
if(!d.exists(dhcpDirectory))
dhcpDirectory = "/var/run";
// See if we have
QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
// If there is no DHCP information then exit now with no errors.
if(!QFile::exists(dhcpFile)){
emit(updateInterface(this));
return true;
}
file.setName(dhcpFile);
if (!file.open(IO_ReadOnly)){
qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
return false;
}
// leaseTime and renewalTime and used if pid and deamon exe can be accessed.
int leaseTime = 0;
int renewalTime = 0;
stream.setDevice( &file );
while ( !stream.eof() ) {