[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] fix warning about always-false comparison; detect too-large...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] fix warning about always-false comparison; detect too-large...
- From: nickm@seul.org (Nick Mathewson)
- Date: Wed, 13 Oct 2004 15:53:36 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 13 Oct 2004 15:53:53 -0400
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv22839/or
Modified Files:
rendservice.c
Log Message:
fix warning about always-false comparison; detect too-large realport better
Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- rendservice.c 12 Oct 2004 20:22:09 -0000 1.86
+++ rendservice.c 13 Oct 2004 19:53:34 -0000 1.87
@@ -128,7 +128,8 @@
static rend_service_port_config_t *parse_port_config(const char *string)
{
int virtport;
- uint16_t realport;
+ int realport;
+ uint16_t p;
uint32_t addr;
char *endptr;
rend_service_port_config_t *result;
@@ -148,12 +149,11 @@
realport = virtport;
addr = 0x7F000001u; /* 127.0.0.1 */
} else if (strchr(string, ':') || strchr(string, '.')) {
- if (parse_addr_port(string, NULL, &addr, &realport)<0) {
+ if (parse_addr_port(string, NULL, &addr, &p)<0) {
log_fn(LOG_WARN,"Unparseable address in hidden service port configuration");
return NULL;
}
- if (!realport)
- realport = virtport;
+ realport = p?p:virtport;
} else {
/* No addr:port, no addr -- must be port. */
realport = strtol(string, &endptr, 10);