diff options
author | irungentoo <irungentoo@gmail.com> | 2013-08-06 17:35:26 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-06 17:35:26 -0700 |
commit | d04f2d0e51931db5fbd8c672c44bb1e59fc58b79 (patch) | |
tree | 42f892aea55a6394d5d6ff0dbace2214675cbd71 | |
parent | 804216580d1db3ad9ad79da5f1f1183b5aec2568 (diff) | |
parent | e18bbaf118acd47a99197c19f61533f7886c686f (diff) |
Merge pull request #366 from nickodell/master
Misc bugfixes
-rw-r--r-- | core/LAN_discovery.c | 4 | ||||
-rw-r--r-- | core/Messenger.c | 4 | ||||
-rw-r--r-- | testing/nTox.c | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/core/LAN_discovery.c b/core/LAN_discovery.c index 55953685..26b3930c 100644 --- a/core/LAN_discovery.c +++ b/core/LAN_discovery.c | |||
@@ -70,6 +70,10 @@ static uint32_t get_broadcast(void) | |||
70 | } | 70 | } |
71 | } | 71 | } |
72 | close(sock); | 72 | close(sock); |
73 | if(sock_holder == NULL) { | ||
74 | perror("[!] no broadcast device found"); | ||
75 | return 0; | ||
76 | } | ||
73 | 77 | ||
74 | return sock_holder->sin_addr.s_addr; | 78 | return sock_holder->sin_addr.s_addr; |
75 | } | 79 | } |
diff --git a/core/Messenger.c b/core/Messenger.c index 9fa643bb..5532c9cc 100644 --- a/core/Messenger.c +++ b/core/Messenger.c | |||
@@ -116,7 +116,7 @@ int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length) | |||
116 | return FAERR_ALREADYSENT; | 116 | return FAERR_ALREADYSENT; |
117 | 117 | ||
118 | uint32_t i; | 118 | uint32_t i; |
119 | for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ | 119 | for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ |
120 | if(friendlist[i].status == NOFRIEND) { | 120 | if(friendlist[i].status == NOFRIEND) { |
121 | DHT_addfriend(client_id); | 121 | DHT_addfriend(client_id); |
122 | friendlist[i].status = FRIEND_ADDED; | 122 | friendlist[i].status = FRIEND_ADDED; |
@@ -141,7 +141,7 @@ int m_addfriend_norequest(uint8_t * client_id) | |||
141 | if (getfriend_id(client_id) != -1) | 141 | if (getfriend_id(client_id) != -1) |
142 | return -1; | 142 | return -1; |
143 | uint32_t i; | 143 | uint32_t i; |
144 | for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ | 144 | for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ |
145 | if(friendlist[i].status == NOFRIEND) { | 145 | if(friendlist[i].status == NOFRIEND) { |
146 | DHT_addfriend(client_id); | 146 | DHT_addfriend(client_id); |
147 | friendlist[i].status = FRIEND_REQUESTED; | 147 | friendlist[i].status = FRIEND_REQUESTED; |
diff --git a/testing/nTox.c b/testing/nTox.c index 63d0c32e..ecdba1e3 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -410,6 +410,8 @@ void load_key(char *path) | |||
410 | } | 410 | } |
411 | } | 411 | } |
412 | 412 | ||
413 | if(fclose(data_file) < 0) | ||
414 | perror("[!] fclose failed"); | ||
413 | return; | 415 | return; |
414 | 416 | ||
415 | FILE_ERROR: | 417 | FILE_ERROR: |