circo

claudio's IRC oasis
git clone git://git.bitsmanent.org/circo
Log | Files | Refs | README | LICENSE

commit aeb6d46cd9baf1720e20144fcb04ad75ebbe5ca6
parent bf9cbb58d2ac8694ad2be164d1497de200010121
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Sat, 21 Apr 2018 13:11:03 +0200

Proper check when connecting in cmd_server()

Diffstat:
Mcirco.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/circo.c b/circo.c @@ -320,6 +320,7 @@ cmd_rejoinall(char *cmd, char *s) { void cmd_server(char *cmd, char *s) { char *h, *p; + int fd; p = skip(s, ' '); h = s; @@ -333,11 +334,11 @@ cmd_server(char *cmd, char *s) { } if(srv) sout("QUIT"); - srv = fdopen(dial(h, p), "r+"); - if(!srv) { + if((fd = dial(h, p)) < 0) { bprintf(status, "Cannot connect to %s on port %s\n", h, p); return; } + srv = fdopen(dial(h, p), "r+"); printf(TTLSET, h); setbuf(srv, NULL); sout("NICK %s", nick);