-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
Signed-off-by: falkTX <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,12 +255,17 @@ void socket_set_receive_cb(void (*receive_cb)(msg_t *msg)) | |
|
||
int socket_send(int destination, const char *buffer, int size) | ||
{ | ||
int ret; | ||
int ret = -1; | ||
|
||
ret = send(destination, buffer, size, 0); | ||
if (ret < 0) | ||
while (size > 0) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
falkTX
Author
Member
|
||
{ | ||
perror("send error"); | ||
ret = send(destination, buffer, size, 0); | ||
if (ret < 0) | ||
{ | ||
perror("send error"); | ||
} | ||
size -= ret; | ||
buffer += ret; | ||
} | ||
|
||
return ret; | ||
|
I belive this fix introduced an error loop.
Lets say the send() function in line 262 hits an error an error like "Socket operation on non-socket".
Then ret = -1, and with each iteration size -= -1, and buffer underflows finnaly. Generally bad things happen (my Raspi crashes)