mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-20 05:37:57 +00:00
Fix compile errors and some warnings on solaris.
This commit is contained in:
parent
eff3e9ec8f
commit
dd3a5ae62d
@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include "overlay_address.h"
|
||||
#include "overlay_buffer.h"
|
||||
#include "overlay_packet.h"
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#define MAX_BPIS 1024
|
||||
#define BPI_MASK 0x3ff
|
||||
|
@ -57,8 +57,10 @@ struct overlay_buffer *ob_static(unsigned char *bytes, int size){
|
||||
// Both buffers will point to the same memory region.
|
||||
// It is up to the caller to ensure this buffer is not used after the parent buffer is freed.
|
||||
struct overlay_buffer *ob_slice(struct overlay_buffer *b, int offset, int length){
|
||||
if (offset+length > b->allocSize)
|
||||
return WHYNULL("Buffer isn't long enough to slice");
|
||||
if (offset+length > b->allocSize) {
|
||||
WHY("Buffer isn't long enough to slice");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct overlay_buffer *ret=calloc(sizeof(struct overlay_buffer),1);
|
||||
if (!ret)
|
||||
@ -212,8 +214,10 @@ int ob_append_byte(struct overlay_buffer *b,unsigned char byte)
|
||||
|
||||
unsigned char *ob_append_space(struct overlay_buffer *b,int count)
|
||||
{
|
||||
if (ob_makespace(b,count))
|
||||
return WHYNULL("ob_makespace() failed");
|
||||
if (ob_makespace(b,count)) {
|
||||
WHY("ob_makespace() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned char *r=&b->bytes[b->position];
|
||||
b->position+=count;
|
||||
|
@ -95,7 +95,13 @@ int olsr_init_socket(void){
|
||||
/* Automatically close socket on calls to exec().
|
||||
This makes life easier when we restart with an exec after receiving
|
||||
a bad signal. */
|
||||
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, NULL) | O_CLOEXEC);
|
||||
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, NULL) |
|
||||
#ifdef FD_CLOEXEC
|
||||
FD_CLOEXEC
|
||||
#else
|
||||
O_CLOEXEC
|
||||
#endif
|
||||
);
|
||||
|
||||
if (bind(fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in))) {
|
||||
WHY_perror("Bind failed");
|
||||
@ -111,7 +117,7 @@ int olsr_init_socket(void){
|
||||
|
||||
static void parse_frame(struct overlay_buffer *buff){
|
||||
struct overlay_frame frame;
|
||||
u_int8_t addr_len;
|
||||
uint8_t addr_len;
|
||||
struct in_addr *addr;
|
||||
struct decode_context context={
|
||||
.please_explain=NULL,
|
||||
|
@ -288,7 +288,7 @@ struct overlay_frame *op_dup(struct overlay_frame *in)
|
||||
|
||||
/* clone the frame */
|
||||
struct overlay_frame *out=malloc(sizeof(struct overlay_frame));
|
||||
if (!out) return WHYNULL("malloc() failed");
|
||||
if (!out) { WHY("malloc() failed"); return NULL; }
|
||||
|
||||
/* copy main data structure */
|
||||
bcopy(in,out,sizeof(struct overlay_frame));
|
||||
|
@ -352,7 +352,7 @@ struct overlay_neighbour *overlay_route_get_neighbour_structure(overlay_node *no
|
||||
return NULL;
|
||||
|
||||
if (overlay_route_make_neighbour(node))
|
||||
return WHYNULL("overlay_route_make_neighbour() failed");
|
||||
{ WHY("overlay_route_make_neighbour() failed"); return NULL; }
|
||||
}
|
||||
|
||||
/* Get neighbour structure */
|
||||
|
Loading…
Reference in New Issue
Block a user