Skip to content

Commit

Permalink
Merge branch 'raspbian'
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedeer committed Dec 13, 2014
2 parents 99a6683 + 4f28d0b commit c103970
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DEPS=libtoxcore
CC=gcc
CFLAGS=-g #-std=c99
CFLAGS += $(shell pkg-config --cflags $(DEPS))
LDFLAGS=-g -pthread -lm -static
LDFLAGS=-g -pthread -lm -static -lrt
LDFLAGS += $(shell pkg-config --libs $(DEPS))
OBJECTS=$(SOURCES:.c=.o)
INCLUDES = $(wildcard *.h)
Expand Down
19 changes: 19 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,12 @@ int parse_lossless_packet(void *sender_uc, const uint8_t *data, uint32_t len)
return -1;
}

if(!data)
{
fprintf(stderr, "Got NULL pointer from toxcore - WTF?\n");
return -1;
}

if(data[0] != PROTOCOL_MAGIC_HIGH || data[1] != PROTOCOL_MAGIC_LOW)
{
fprintf(stderr, "Received data frame with invalid protocol magic number 0x%x%x\n", data[0], data[1]);
Expand Down Expand Up @@ -835,6 +841,19 @@ int main(int argc, char *argv[])
tox_options.proxy_enabled = 0;

tox = tox_new(&tox_options);
if(tox == NULL)
{
fprintf(stderr, "tox_new() failed - trying without proxy\n");
if(!tox_options.proxy_enabled || (tox_options.proxy_enabled = 0, (tox = tox_new(&tox_options)) == NULL))
{
fprintf(stderr, "tox_new() failed - trying without IPv6\n");
if(!tox_options.ipv6enabled || (tox_options.ipv6enabled = 0, (tox = tox_new(&tox_options)) == NULL))
{
fprintf(stderr, "tox_new() failed - exiting\n");
exit(1);
}
}
}

set_tox_username(tox);

Expand Down

0 comments on commit c103970

Please sign in to comment.