mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
fix warnings
svn path=/trunk/; revision=18670
This commit is contained in:
parent
131429986c
commit
aff22063c4
5 changed files with 32 additions and 13 deletions
|
@ -76,4 +76,18 @@ new_hash_bucket(void)
|
||||||
return (rval);
|
return (rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_hash_bucket(struct hash_bucket *hb) { free(hb); }
|
void
|
||||||
|
dfree(void *ptr, char *name)
|
||||||
|
{
|
||||||
|
if (!ptr) {
|
||||||
|
warning("dfree %s: free on null pointer.", name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_hash_bucket(struct hash_bucket *ptr, char *name)
|
||||||
|
{
|
||||||
|
dfree(ptr, name);
|
||||||
|
}
|
||||||
|
|
|
@ -234,7 +234,7 @@ state_reboot(void *ipp)
|
||||||
/* make_request doesn't initialize xid because it normally comes
|
/* make_request doesn't initialize xid because it normally comes
|
||||||
from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER,
|
from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER,
|
||||||
so pick an xid now. */
|
so pick an xid now. */
|
||||||
ip->client->xid = arc4random();
|
ip->client->xid = rand();
|
||||||
|
|
||||||
/* Make a DHCPREQUEST packet, and set appropriate per-interface
|
/* Make a DHCPREQUEST packet, and set appropriate per-interface
|
||||||
flags. */
|
flags. */
|
||||||
|
@ -940,7 +940,7 @@ send_discover(void *ipp)
|
||||||
ip->client->interval =
|
ip->client->interval =
|
||||||
ip->client->config->initial_interval;
|
ip->client->config->initial_interval;
|
||||||
else {
|
else {
|
||||||
ip->client->interval += (arc4random() >> 2) %
|
ip->client->interval += (rand() >> 2) %
|
||||||
(2 * ip->client->interval);
|
(2 * ip->client->interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +949,7 @@ send_discover(void *ipp)
|
||||||
ip->client->config->backoff_cutoff)
|
ip->client->config->backoff_cutoff)
|
||||||
ip->client->interval =
|
ip->client->interval =
|
||||||
((ip->client->config->backoff_cutoff / 2)
|
((ip->client->config->backoff_cutoff / 2)
|
||||||
+ ((arc4random() >> 2) %
|
+ ((rand() >> 2) %
|
||||||
ip->client->config->backoff_cutoff));
|
ip->client->config->backoff_cutoff));
|
||||||
} else if (!ip->client->interval)
|
} else if (!ip->client->interval)
|
||||||
ip->client->interval =
|
ip->client->interval =
|
||||||
|
@ -1142,7 +1142,7 @@ send_request(void *ipp)
|
||||||
if (!ip->client->interval)
|
if (!ip->client->interval)
|
||||||
ip->client->interval = ip->client->config->initial_interval;
|
ip->client->interval = ip->client->config->initial_interval;
|
||||||
else
|
else
|
||||||
ip->client->interval += ((arc4random() >> 2) %
|
ip->client->interval += ((rand() >> 2) %
|
||||||
(2 * ip->client->interval));
|
(2 * ip->client->interval));
|
||||||
|
|
||||||
/* Don't backoff past cutoff. */
|
/* Don't backoff past cutoff. */
|
||||||
|
@ -1150,7 +1150,7 @@ send_request(void *ipp)
|
||||||
ip->client->config->backoff_cutoff)
|
ip->client->config->backoff_cutoff)
|
||||||
ip->client->interval =
|
ip->client->interval =
|
||||||
((ip->client->config->backoff_cutoff / 2) +
|
((ip->client->config->backoff_cutoff / 2) +
|
||||||
((arc4random() >> 2) % ip->client->interval));
|
((rand() >> 2) % ip->client->interval));
|
||||||
|
|
||||||
/* If the backoff would take us to the expiry time, just set the
|
/* If the backoff would take us to the expiry time, just set the
|
||||||
timeout to the expiry time. */
|
timeout to the expiry time. */
|
||||||
|
@ -1280,7 +1280,7 @@ make_discover(struct interface_info *ip, struct client_lease *lease)
|
||||||
ip->client->packet.htype = ip->hw_address.htype;
|
ip->client->packet.htype = ip->hw_address.htype;
|
||||||
ip->client->packet.hlen = ip->hw_address.hlen;
|
ip->client->packet.hlen = ip->hw_address.hlen;
|
||||||
ip->client->packet.hops = 0;
|
ip->client->packet.hops = 0;
|
||||||
ip->client->packet.xid = arc4random();
|
ip->client->packet.xid = rand();
|
||||||
ip->client->packet.secs = 0; /* filled in by send_discover. */
|
ip->client->packet.secs = 0; /* filled in by send_discover. */
|
||||||
ip->client->packet.flags = 0;
|
ip->client->packet.flags = 0;
|
||||||
|
|
||||||
|
@ -1986,7 +1986,7 @@ int
|
||||||
ipv4addrs(char * buf)
|
ipv4addrs(char * buf)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
struct in_addr jnk;
|
unsigned long jnk;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
note("Input: %s\n", buf);
|
note("Input: %s\n", buf);
|
||||||
|
@ -1994,7 +1994,8 @@ ipv4addrs(char * buf)
|
||||||
do {
|
do {
|
||||||
tmp = strtok(buf, " ");
|
tmp = strtok(buf, " ");
|
||||||
note("got %s\n", tmp);
|
note("got %s\n", tmp);
|
||||||
if( tmp && inet_aton(tmp, &jnk) ) i++;
|
jnk = inet_addr( tmp );
|
||||||
|
if( tmp ) i++;
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
} while( tmp );
|
} while( tmp );
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,9 @@ pair cons(caddr_t, pair);
|
||||||
struct string_list *new_string_list(size_t size);
|
struct string_list *new_string_list(size_t size);
|
||||||
struct hash_table *new_hash_table(int);
|
struct hash_table *new_hash_table(int);
|
||||||
struct hash_bucket *new_hash_bucket(void);
|
struct hash_bucket *new_hash_bucket(void);
|
||||||
|
void dfree(void *, char *);
|
||||||
|
void free_hash_bucket(struct hash_bucket *, char *);
|
||||||
|
|
||||||
|
|
||||||
/* bpf.c */
|
/* bpf.c */
|
||||||
int if_register_bpf(struct interface_info *);
|
int if_register_bpf(struct interface_info *);
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define DHCP_OPTION_DATA
|
#define DHCP_OPTION_DATA
|
||||||
#include "rosdhcp.h"
|
#include "rosdhcp.h"
|
||||||
|
@ -592,7 +593,8 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
foo.s_addr = htonl(getULong(dp));
|
foo.s_addr = htonl(getULong(dp));
|
||||||
opcount = strlcpy(op, inet_ntoa(foo), opleft);
|
strncpy(op, inet_ntoa(foo), opleft - 1);
|
||||||
|
op[opleft - 1] = ANSI_NULL;
|
||||||
if (opcount >= opleft)
|
if (opcount >= opleft)
|
||||||
goto toobig;
|
goto toobig;
|
||||||
opleft -= opcount;
|
opleft -= opcount;
|
||||||
|
@ -650,8 +652,8 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
|
||||||
opleft -= opcount;
|
opleft -= opcount;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
opcount = strlcpy(op,
|
opcount = (size_t) strncpy(op, *dp++ ? "true" : "false", opleft - 1);
|
||||||
*dp++ ? "true" : "false", opleft);
|
op[opleft - 1] = ANSI_NULL;
|
||||||
if (opcount >= opleft)
|
if (opcount >= opleft)
|
||||||
goto toobig;
|
goto toobig;
|
||||||
opleft -= opcount;
|
opleft -= opcount;
|
||||||
|
|
|
@ -93,7 +93,6 @@ int addr_eq( struct iaddr a, struct iaddr b ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *dmalloc( int size, char *name ) { return malloc( size ); }
|
void *dmalloc( int size, char *name ) { return malloc( size ); }
|
||||||
void dfree( void *v, char *name ) { free( v ); }
|
|
||||||
|
|
||||||
int read_client_conf(void) {
|
int read_client_conf(void) {
|
||||||
error("util.c read_client_conf not implemented!");
|
error("util.c read_client_conf not implemented!");
|
||||||
|
|
Loading…
Reference in a new issue