The following commit has been merged in the master branch: commit ea9c5770b25c72246430a5e3e8436f9b235f4b4c Author: Marek Lindner lindner_marek@yahoo.de Date: Wed Jan 31 17:58:14 2007 +0100
fix allocate.c
diff --git a/allocate.c b/allocate.c index 14dd362..707313b 100644 --- a/allocate.c +++ b/allocate.c @@ -56,7 +56,7 @@ void checkIntegrity(void) { if (walker->magicNumber != MAGIC_NUMBER) { - fprintf(stderr, "Invalid magic number in header: %08x, malloc tag = %d\n", walker->magicNumber, walker->tag); + fprintf(stderr, "checkIntegrity - invalid magic number in header: %08x, malloc tag = %d\n", walker->magicNumber, walker->tag); exit(1); }
@@ -66,7 +66,7 @@ void checkIntegrity(void)
if (chunkTrailer->magicNumber != MAGIC_NUMBER) { - fprintf(stderr, "Invalid magic number in header: %08x, malloc tag = %d\n", chunkTrailer->magicNumber, walker->tag); + fprintf(stderr, "checkIntegrity - invalid magic number in trailer: %08x, malloc tag = %d\n", chunkTrailer->magicNumber, walker->tag); exit(1); } } @@ -127,7 +127,7 @@ void *debugRealloc(void *memoryParameter, unsigned int length, int tag)
if (chunkHeader->magicNumber != MAGIC_NUMBER) { - fprintf(stderr, "Invalid magic number in header: %08x, malloc tag = %d\n", chunkHeader->magicNumber, chunkHeader->tag); + fprintf(stderr, "debugRealloc - invalid magic number in header: %08x, malloc tag = %d\n", chunkHeader->magicNumber, chunkHeader->tag); exit(1); }
@@ -135,7 +135,7 @@ void *debugRealloc(void *memoryParameter, unsigned int length, int tag)
if (chunkTrailer->magicNumber != MAGIC_NUMBER) { - fprintf(stderr, "Invalid magic number in header: %08x, malloc tag = %d\n", chunkTrailer->magicNumber, chunkHeader->tag); + fprintf(stderr, "debugRealloc - invalid magic number in trailer: %08x, malloc tag = %d\n", chunkTrailer->magicNumber, chunkHeader->tag); exit(1); } } @@ -169,7 +169,7 @@ void debugFree(void *memoryParameter, int tag)
if (chunkHeader->magicNumber != MAGIC_NUMBER) { - fprintf(stderr, "Invalid magic number in header: %08x, malloc tag = %d, free tag = %d\n", chunkHeader->magicNumber, chunkHeader->tag, tag); + fprintf(stderr, "debugFree - invalid magic number in header: %08x, malloc tag = %d, free tag = %d\n", chunkHeader->magicNumber, chunkHeader->tag, tag); exit(1); }
@@ -199,7 +199,7 @@ void debugFree(void *memoryParameter, int tag)
if (chunkTrailer->magicNumber != MAGIC_NUMBER) { - fprintf(stderr, "Invalid magic number in header: %08x, malloc tag = %d, free tag = %d\n", chunkTrailer->magicNumber, chunkHeader->tag, tag); + fprintf(stderr, "debugFree - invalid magic number in trailer: %08x, malloc tag = %d, free tag = %d\n", chunkTrailer->magicNumber, chunkHeader->tag, tag); exit(1); }
diff --git a/batman.h b/batman.h index 5cdcd69..aba8e7f 100644 --- a/batman.h +++ b/batman.h @@ -85,12 +85,12 @@ extern struct debug_clients debug_clients;
struct packet { - uint32_t orig; - uint8_t flags; /* 0xF0: UNIDIRECTIONAL link, 0x80: DIRECTLINK flag, ... */ - uint8_t ttl; - uint16_t seqno; - uint8_t gwflags; /* flags related to gateway functions: gateway class */ - uint8_t version; /* batman version field */ + uint32_t orig; + uint8_t flags; /* 0xF0: UNIDIRECTIONAL link, 0x80: DIRECTLINK flag, ... */ + uint8_t ttl; + uint16_t seqno; + uint8_t gwflags; /* flags related to gateway functions: gateway class */ + uint8_t version; /* batman version field */ } __attribute__((packed));
struct orig_node /* structure for orig_list maintaining nodes of mesh */ diff --git a/posix-specific.c b/posix-specific.c index 6d03f48..4e80cfe 100644 --- a/posix-specific.c +++ b/posix-specific.c @@ -1296,12 +1296,13 @@ int receive_packet( unsigned char *packet_buff, int packet_buff_len, int *hna_bu fd_set tmp_wait_set = receive_wait_set;
- tv.tv_sec = timeout / 1000; - tv.tv_usec = ( timeout % 1000 ) * 1000; addr_len = sizeof(struct sockaddr_in);
while (1) {
+ tv.tv_sec = timeout / 1000; + tv.tv_usec = ( timeout % 1000 ) * 1000; + res = select( receive_max_sock + 1, &tmp_wait_set, NULL, NULL, &tv );
if ( res >= 0 ) diff --git a/posix.c b/posix.c index b6aad53..12684c8 100644 --- a/posix.c +++ b/posix.c @@ -245,7 +245,7 @@ int main( int argc, char *argv[] ) { // memset( &device_node_array[0], 0, sizeof( device_node_array ) ); // printf("B.A.T.M.A.N-experimental %s\n", VERSION);
- /* Check if user is root */ + /* check if user is root */ if ( ( getuid() ) || ( getgid() ) ) {
fprintf( stderr, "Error - you must be root to run batmand !\n" );