From a999b042c19d9f07caa3171df8e569766de4ac01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kou=C5=99il?= Date: Thu, 8 Dec 2011 10:28:41 +0000 Subject: [PATCH] socket initialized to -1 --- emi.canl.canl-c/src/canl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; } -- 1.8.2.3