From: John Hodge (sonata) Date: Sun, 2 Dec 2012 04:17:36 +0000 (+0800) Subject: Usermode/dhcpclient - Fixed use of O_RDWR for _SysOpen X-Git-Tag: rel0.15~616 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=6ec7fbaa23b80eb3c65752617df04e813f38ee54;p=tpg%2Facess2.git Usermode/dhcpclient - Fixed use of O_RDWR for _SysOpen --- diff --git a/Usermode/Applications/dhcpclient_src/main.c b/Usermode/Applications/dhcpclient_src/main.c index aaf8de7c..b9b28149 100644 --- a/Usermode/Applications/dhcpclient_src/main.c +++ b/Usermode/Applications/dhcpclient_src/main.c @@ -2,7 +2,6 @@ * * http://www.ietf.org/rfc/rfc2131.txt */ -#include #include #include #include @@ -242,7 +241,7 @@ int Start_Interface(tInterface *Iface) // Open UDP Client snprintf(path, sizeof(path), "/Devices/ip/%i/udp", Iface->Num); - Iface->SocketFD = fd = _SysOpen(path, O_RDWR); + Iface->SocketFD = fd = _SysOpen(path, OPENFLAG_READ|OPENFLAG_WRITE); if( fd == -1 ) { fprintf(stderr, "ERROR: Unable to open '%s'\n", path); return -1; @@ -300,7 +299,10 @@ void Send_DHCPDISCOVER(tInterface *Iface) data[2] = 4; data[3] = 0; // AddrType data[4] = 255; data[5] = 255; data[6] = 255; data[7] = 255; - _SysWrite(Iface->SocketFD, data, sizeof(data)); + i = _SysWrite(Iface->SocketFD, data, sizeof(data)); + if( i != sizeof(data) ) { + _SysDebug("_SysWrite failed (%i != %i)", i, sizeof(data)); + } Update_State(Iface, STATE_DISCOVER_SENT); }