From: Daniel KouĊ™il Date: Thu, 8 Dec 2011 10:28:41 +0000 (+0000) Subject: socket initialized to -1 X-Git-Tag: merge_30_head_take2_after~20 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=a999b042c19d9f07caa3171df8e569766de4ac01;p=jra1mw.git socket initialized to -1 --- diff --git a/emi.canl.canl-c/src/canl.c b/emi.canl.canl-c/src/canl.c index ee800f7..2058ffd 100644 --- a/emi.canl.canl-c/src/canl.c +++ b/emi.canl.canl-c/src/canl.c @@ -106,6 +106,8 @@ static int init_io_content(glb_ctx *cc, io_handler *io) goto end; } + io->sock = -1; + end: if (err) update_error(cc, "failed to initialize io_handler"); @@ -232,7 +234,7 @@ int canl_io_accept(canl_ctx cc, canl_io_handler io, int new_fd, end: if (err) - (io_cc)->sock = 0; + (io_cc)->sock = -1; return err; } @@ -256,7 +258,7 @@ int canl_io_close(canl_ctx cc, canl_io_handler io) if (err <= 0) return err; - if (io_cc->sock) { + if (io_cc->sock != -1) { close (io_cc->sock); io_cc->sock = -1; }