From b3892e801f74c0fc6fae81fe7eb48e8b75a82c56 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 16 Feb 2006 09:29:35 -0800 Subject: [PATCH] Correct the logic when to loop for the port range --- tftpd/tftpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c index 5e2a26e..24fe904 100644 --- a/tftpd/tftpd.c +++ b/tftpd/tftpd.c @@ -289,7 +289,7 @@ pick_port_bind(int sockfd, struct sockaddr_in *myaddr) if (bind(sockfd, (struct sockaddr *)myaddr, sizeof *myaddr) < 0) { /* Some versions of Linux return EINVAL instead of EADDRINUSE */ - if ( !portrange || !(errno != EINVAL && errno != EADDRINUSE) ) + if ( !(portrange && (errno == EINVAL || errno == EADDRINUSE)) ) return -1; /* Normally, we shouldn't have to loop, but some situations involving