Skip to content

Commit

Permalink
transport-helper.c: fix check for (size_t < 0)
Browse files Browse the repository at this point in the history
'bytes' is of type size_t which is unsigned thus can't be negative.  But
the assigned write() returns ssize_t, and -1 on error.

For testing < 0, 'bytes' needs to be of a signed type.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nicolas Kaiser authored and Junio C Hamano committed Mar 9, 2011
1 parent 07873dc commit 803dbdb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion transport-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ static int udt_do_read(struct unidirectional_transfer *t)
*/
static int udt_do_write(struct unidirectional_transfer *t)
{
size_t bytes;
ssize_t bytes;

if (t->bufuse == 0)
return 0; /* Nothing to write. */
Expand Down

0 comments on commit 803dbdb

Please sign in to comment.