From 6ec7fbaa23b80eb3c65752617df04e813f38ee54 Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Sun, 2 Dec 2012 12:17:36 +0800 Subject: [PATCH] Usermode/dhcpclient - Fixed use of O_RDWR for _SysOpen --- Usermode/Applications/dhcpclient_src/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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); } -- 2.20.1