summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-04-08 17:48:56 +1000
committerDamien Miller <djm@mindrot.org>2000-04-08 17:48:56 +1000
commitbc7c7cceea205733e3d0902bc751009b5836ff9c (patch)
tree879d315a66bc070c2410ee9da19b93780be517d1
parent73a26627f255088b55172f7947c8c2419634059b (diff)
- Avoid some compiler warnings in fake-get*.c
- Add IPTOS macros for systems which lack them
-rw-r--r--ChangeLog4
-rw-r--r--defines.h10
-rw-r--r--entropy.c3
-rw-r--r--fake-getaddrinfo.c16
-rw-r--r--fake-getnameinfo.c4
5 files changed, 25 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 05d37dc4a..39284fdb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120000408
2 - Avoid some compiler warnings in fake-get*.c
3 - Add IPTOS macros for systems which lack them
4
120000406 520000406
2 - OpenBSD CVS update: 6 - OpenBSD CVS update:
3 - [channels.c] 7 - [channels.c]
diff --git a/defines.h b/defines.h
index b22d703f5..f8a23b88d 100644
--- a/defines.h
+++ b/defines.h
@@ -9,6 +9,8 @@
9 9
10#include <netinet/in.h> /* For IPv6 macros */ 10#include <netinet/in.h> /* For IPv6 macros */
11 11
12#include <netinet/ip.h> /* For IPTOS macros */
13
12#ifdef HAVE_SYS_BITYPES_H 14#ifdef HAVE_SYS_BITYPES_H
13# include <sys/bitypes.h> /* For u_intXX_t */ 15# include <sys/bitypes.h> /* For u_intXX_t */
14#endif 16#endif
@@ -55,6 +57,14 @@ enum
55# define SHUT_RDWR SHUT_RDWR 57# define SHUT_RDWR SHUT_RDWR
56#endif 58#endif
57 59
60#ifndef IPTOS_LOWDELAY
61# define IPTOS_LOWDELAY 0x10
62# define IPTOS_THROUGHPUT 0x08
63# define IPTOS_RELIABILITY 0x04
64# define IPTOS_LOWCOST 0x02
65# define IPTOS_MINCOST IPTOS_LOWCOST
66#endif /* IPTOS_LOWDELAY */
67
58/* Types */ 68/* Types */
59 69
60/* If sys/types.h does not supply intXX_t, supply them ourselves */ 70/* If sys/types.h does not supply intXX_t, supply them ourselves */
diff --git a/entropy.c b/entropy.c
index 94e7dcec1..f304e21c1 100644
--- a/entropy.c
+++ b/entropy.c
@@ -41,7 +41,7 @@
41# include <ssl/sha.h> 41# include <ssl/sha.h>
42#endif 42#endif
43 43
44RCSID("$Id: entropy.c,v 1.3 2000/04/04 05:04:10 damien Exp $"); 44RCSID("$Id: entropy.c,v 1.4 2000/04/08 07:48:56 damien Exp $");
45 45
46#ifdef EGD_SOCKET 46#ifdef EGD_SOCKET
47#ifndef offsetof 47#ifndef offsetof
@@ -198,7 +198,6 @@ entropy_source_t entropy_sources[] = {
198 { 0.000, NULL, { NULL, NULL, NULL, NULL, NULL } }, 198 { 0.000, NULL, { NULL, NULL, NULL, NULL, NULL } },
199}; 199};
200 200
201
202double 201double
203stir_from_system(void) 202stir_from_system(void)
204{ 203{
diff --git a/fake-getaddrinfo.c b/fake-getaddrinfo.c
index b918798c4..456c41e58 100644
--- a/fake-getaddrinfo.c
+++ b/fake-getaddrinfo.c
@@ -41,7 +41,7 @@ struct addrinfo *ai;
41 do { 41 do {
42 next = ai->ai_next; 42 next = ai->ai_next;
43 free(ai); 43 free(ai);
44 } while (ai = next); 44 } while (NULL != (ai = next));
45} 45}
46#endif /* !HAVE_FREEADDRINFO */ 46#endif /* !HAVE_FREEADDRINFO */
47 47
@@ -53,8 +53,8 @@ u_long addr;
53{ 53{
54 struct addrinfo *ai; 54 struct addrinfo *ai;
55 55
56 if (ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) + 56 if (NULL != (ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) +
57 sizeof(struct sockaddr_in))) { 57 sizeof(struct sockaddr_in)))) {
58 memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); 58 memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_in));
59 ai->ai_addr = (struct sockaddr *)(ai + 1); 59 ai->ai_addr = (struct sockaddr *)(ai + 1);
60 /* XXX -- ssh doesn't use sa_len */ 60 /* XXX -- ssh doesn't use sa_len */
@@ -83,25 +83,25 @@ struct addrinfo **res;
83 else 83 else
84 port = 0; 84 port = 0;
85 if (hints && hints->ai_flags & AI_PASSIVE) 85 if (hints && hints->ai_flags & AI_PASSIVE)
86 if (*res = malloc_ai(port, htonl(0x00000000))) 86 if (NULL != (*res = malloc_ai(port, htonl(0x00000000))))
87 return 0; 87 return 0;
88 else 88 else
89 return EAI_MEMORY; 89 return EAI_MEMORY;
90 if (!hostname) 90 if (!hostname)
91 if (*res = malloc_ai(port, htonl(0x7f000001))) 91 if (NULL != (*res = malloc_ai(port, htonl(0x7f000001))))
92 return 0; 92 return 0;
93 else 93 else
94 return EAI_MEMORY; 94 return EAI_MEMORY;
95 if (inet_addr(hostname) != -1) 95 if (inet_addr(hostname) != -1)
96 if (*res = malloc_ai(port, inet_addr(hostname))) 96 if (NULL != (*res = malloc_ai(port, inet_addr(hostname))))
97 return 0; 97 return 0;
98 else 98 else
99 return EAI_MEMORY; 99 return EAI_MEMORY;
100 if ((hp = gethostbyname(hostname)) && 100 if ((hp = gethostbyname(hostname)) &&
101 hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { 101 hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
102 for (i = 0; hp->h_addr_list[i]; i++) 102 for (i = 0; hp->h_addr_list[i]; i++)
103 if (cur = malloc_ai(port, 103 if (NULL != (cur = malloc_ai(port,
104 ((struct in_addr *)hp->h_addr_list[i])->s_addr)) { 104 ((struct in_addr *)hp->h_addr_list[i])->s_addr))) {
105 if (prev) 105 if (prev)
106 prev->ai_next = cur; 106 prev->ai_next = cur;
107 else 107 else
diff --git a/fake-getnameinfo.c b/fake-getnameinfo.c
index bf1184e24..f74f3128f 100644
--- a/fake-getnameinfo.c
+++ b/fake-getnameinfo.c
@@ -46,8 +46,8 @@ int flags;
46 return 0; 46 return 0;
47 } 47 }
48 else 48 else
49 if (hp = gethostbyaddr((char *)&sin->sin_addr, sizeof(struct in_addr), 49 if (NULL != (hp = gethostbyaddr((char *)&sin->sin_addr,
50 AF_INET)) 50 sizeof(struct in_addr), AF_INET)))
51 if (strlen(hp->h_name) > hostlen) 51 if (strlen(hp->h_name) > hostlen)
52 return EAI_MEMORY; 52 return EAI_MEMORY;
53 else { 53 else {