Skip to content

Commit

Permalink
gmetad: avoid always false check due to use of unsigned in readline r…
Browse files Browse the repository at this point in the history
…eturn

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.
  • Loading branch information
carenas committed Jan 24, 2009
1 parent 4032832 commit eaaf2a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gmetad/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit eaaf2a3

Please sign in to comment.