chiark
/
gitweb
/
~mdw
/
adns
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Licensing: Delete FSF address from INSTALL
[adns]
/
src
/
setup.c
diff --git
a/src/setup.c
b/src/setup.c
index 09f044b91c03f681a37a4cc32995a236784fa92f..b51502fb4ce24227ece73dd80cb6f48b2fe447d0 100644
(file)
--- a/
src/setup.c
+++ b/
src/setup.c
@@
-12,7
+12,7
@@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version
2
, or (at your option)
+ * the Free Software Foundation; either version
3
, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* any later version.
*
* This program is distributed in the hope that it will be useful,
@@
-21,8
+21,7
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with this program; if not, write to the Free Software Foundation.
*/
#include <stdlib.h>
*/
#include <stdlib.h>
@@
-580,7
+579,7
@@
static int init_begin(adns_state *ads_r, adns_initflags flags,
LIST_INIT(ads->intdone);
ads->forallnext= 0;
ads->nextid= 0x311f;
LIST_INIT(ads->intdone);
ads->forallnext= 0;
ads->nextid= 0x311f;
- ads->nudp= 0;
+ ads->nudp
sockets
= 0;
ads->tcpsocket= -1;
adns__vbuf_init(&ads->tcpsend);
adns__vbuf_init(&ads->tcprecv);
ads->tcpsocket= -1;
adns__vbuf_init(&ads->tcpsend);
adns__vbuf_init(&ads->tcprecv);
@@
-604,7
+603,7
@@
static int init_finish(adns_state ads) {
struct sockaddr_in sin;
struct protoent *proto;
struct udpsocket *udp;
struct sockaddr_in sin;
struct protoent *proto;
struct udpsocket *udp;
- int i
, j
;
+ int i;
int r;
if (!ads->nservers) {
int r;
if (!ads->nservers) {
@@
-618,16
+617,16
@@
static int init_finish(adns_state ads) {
}
proto= getprotobyname("udp"); if (!proto) { r= ENOPROTOOPT; goto x_free; }
}
proto= getprotobyname("udp"); if (!proto) { r= ENOPROTOOPT; goto x_free; }
- ads->nudp= 0;
+ ads->nudp
sockets
= 0;
for (i=0; i<ads->nservers; i++) {
if (adns__udpsocket_by_af(ads, ads->servers[i].addr.sa.sa_family))
continue;
for (i=0; i<ads->nservers; i++) {
if (adns__udpsocket_by_af(ads, ads->servers[i].addr.sa.sa_family))
continue;
- assert(ads->nudp < MAXUDP);
- udp= &ads->udpsocket
[ads->nudp
];
+ assert(ads->nudp
sockets
< MAXUDP);
+ udp= &ads->udpsocket
s[ads->nudpsockets
];
udp->af= ads->servers[i].addr.sa.sa_family;
udp->fd= socket(udp->af,SOCK_DGRAM,proto->p_proto);
if (udp->fd < 0) { r= errno; goto x_free; }
udp->af= ads->servers[i].addr.sa.sa_family;
udp->fd= socket(udp->af,SOCK_DGRAM,proto->p_proto);
if (udp->fd < 0) { r= errno; goto x_free; }
- ads->nudp++;
+ ads->nudp
sockets
++;
r= adns__setnonblock(ads,udp->fd);
if (r) { r= errno; goto x_closeudp; }
}
r= adns__setnonblock(ads,udp->fd);
if (r) { r= errno; goto x_closeudp; }
}
@@
-635,7
+634,7
@@
static int init_finish(adns_state ads) {
return 0;
x_closeudp:
return 0;
x_closeudp:
- for (
j=0; j<ads->nudp; j++) close(ads->udpsocket[j
].fd);
+ for (
i=0; i<ads->nudpsockets; i++) close(ads->udpsockets[i
].fd);
x_free:
free(ads);
return r;
x_free:
free(ads);
return r;
@@
-752,7
+751,7
@@
void adns_finish(adns_state ads) {
else if (ads->intdone.head) adns__cancel(ads->output.head);
else break;
}
else if (ads->intdone.head) adns__cancel(ads->output.head);
else break;
}
- for (i=0; i<ads->nudp
; i++) close(ads->udpsocket
[i].fd);
+ for (i=0; i<ads->nudp
sockets; i++) close(ads->udpsockets
[i].fd);
if (ads->tcpsocket >= 0) close(ads->tcpsocket);
adns__vbuf_free(&ads->tcpsend);
adns__vbuf_free(&ads->tcprecv);
if (ads->tcpsocket >= 0) close(ads->tcpsocket);
adns__vbuf_free(&ads->tcpsend);
adns__vbuf_free(&ads->tcprecv);