From eaaf2a3019132ca05d91f88ad14d1b177124f506 Mon Sep 17 00:00:00 2001 From: carenas Date: Sat, 24 Jan 2009 10:28:37 +0000 Subject: [PATCH] gmetad: avoid always false check due to use of unsigned in readline return len is defined as socklen_t which is an opaque type usually defined to be unsigned with up to 32bits, check for values lower than 0 will be always false, so use an int instead. --- gmetad/server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gmetad/server.c b/gmetad/server.c index 18de26693..705a8d4de 100644 --- a/gmetad/server.c +++ b/gmetad/server.c @@ -541,6 +541,7 @@ server_thread (void *arg) { int interactive = (arg != NULL); socklen_t len; + int request_len; client_t client; char remote_ip[16]; char request[REQUESTLEN + 1]; @@ -594,8 +595,8 @@ server_thread (void *arg) if (interactive) { - len = readline(client.fd, request, REQUESTLEN); - if (len<0) + request_len = readline(client.fd, request, REQUESTLEN); + if (request_len < 0) { err_msg("server_thread() could not read request from %s", remote_ip); close(client.fd);