X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Firc_src%2Fmain.c;h=119e025d8bcea9b6aaf0a2ffd36d52ef5f6ae69c;hb=0c1bf884877e4b89eb224e91627508d42ca70974;hp=c202c6bd28677fd82012b5a54890968f84ccc3d6;hpb=d5834686ad14b66420060192445f06bce85db389;p=tpg%2Facess2.git diff --git a/Usermode/Applications/irc_src/main.c b/Usermode/Applications/irc_src/main.c index c202c6bd..119e025d 100644 --- a/Usermode/Applications/irc_src/main.c +++ b/Usermode/Applications/irc_src/main.c @@ -193,7 +193,8 @@ int writef(int FD, const char *Format, ...) */ int OpenTCP(const char *AddressString, short PortNumber) { - int fd, addrType, iface; + int fd, addrType; + char *iface; char addrBuffer[8]; // Parse IP Address @@ -205,7 +206,7 @@ int OpenTCP(const char *AddressString, short PortNumber) // Finds the interface for the destination address iface = Net_GetInterface(addrType, addrBuffer); - if( iface == -1 ) { + if( iface == NULL ) { fprintf(stderr, "Unable to find a route to '%s'\n", AddressString); return -1; } @@ -213,12 +214,14 @@ int OpenTCP(const char *AddressString, short PortNumber) // Open client socket // TODO: Move this out to libnet? { - int len = snprintf(NULL, 100, "/Devices/ip/%i/tcpc", iface); + int len = snprintf(NULL, 100, "/Devices/ip/%s/tcpc", iface); char path[len+1]; - snprintf(path, 100, "/Devices/ip/%i/tcpc", iface); + snprintf(path, 100, "/Devices/ip/%s/tcpc", iface); fd = open(path, OPENFLAG_READ|OPENFLAG_WRITE); } + free(iface); + if( fd == -1 ) { return -1; }