From 120315627223bdaef72a26b21574354955e08e2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kou=C5=99il?= Date: Thu, 6 Apr 2006 10:01:23 +0000 Subject: [PATCH] Incorporated Zdenek's patch from HEAD that solves #16050 (Fix multiple typing bugs that can lead to endless looping, correct ambiguity of nwrite() return value.) --- .../project/version.properties | 2 +- org.glite.security.proxyrenewal/src/common.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/org.glite.security.proxyrenewal/project/version.properties b/org.glite.security.proxyrenewal/project/version.properties index 68d8aae..b8eba67 100644 --- a/org.glite.security.proxyrenewal/project/version.properties +++ b/org.glite.security.proxyrenewal/project/version.properties @@ -1,2 +1,2 @@ -module.version=1.3.1 +module.version=1.3.2 module.age=1 diff --git a/org.glite.security.proxyrenewal/src/common.c b/org.glite.security.proxyrenewal/src/common.c index 7b3df64..86cfa4a 100644 --- a/org.glite.security.proxyrenewal/src/common.c +++ b/org.glite.security.proxyrenewal/src/common.c @@ -6,7 +6,7 @@ static int nread(int sock, struct timeval *to, char *buf, size_t buf_len, size_t *read_len) { - size_t count; + int count; size_t remain = buf_len; char *cbuf = buf; fd_set fds; @@ -62,11 +62,11 @@ end: return ret; } -static size_t +static int nwrite(int sock, struct timeval *to, const char *buf, size_t buf_len) { const char *cbuf = buf; - size_t count; + int count; size_t remain = buf_len; fd_set fds; struct timeval timeout,before,after; @@ -99,7 +99,7 @@ nwrite(int sock, struct timeval *to, const char *buf, size_t buf_len) cbuf += count; remain -= count; } - ret = buf_len; + ret = 0; end: if (to) { @@ -156,15 +156,16 @@ int edg_wlpr_Write(int sock, struct timeval *timeout, char *buf, size_t buf_len) { unsigned char length[4]; + int ret; length[0] = (buf_len >> 24) & 0xFF; length[1] = (buf_len >> 16) & 0xFF; length[2] = (buf_len >> 8) & 0xFF; length[3] = (buf_len >> 0) & 0xFF; - if (nwrite(sock, timeout, length, 4) != 4 || - nwrite(sock, timeout, buf, buf_len) != buf_len) - return errno; + if ((ret = nwrite(sock, timeout, length, 4)) != 0 || + (ret = nwrite(sock, timeout, buf, buf_len)) != 0) + return ret; return 0; } -- 1.8.2.3