Skip to content

Commit

Permalink
Better handling of setsockopt
Browse files Browse the repository at this point in the history
  • Loading branch information
scemama committed Sep 15, 2016
1 parent bdeac71 commit 6dc7d61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion f77_zmq.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ int f77_zmq_disconnect_ (void* *socket, char* address_in, int address_len)

int f77_zmq_setsockopt_ (void* *socket, int* option_name, void* option_value, int* option_len, int dummy)
{
return zmq_setsockopt (*socket, *option_name, option_value, *option_len);
int result;
void * value = malloc(*option_len);
memcpy(value, option_value, (size_t) *option_len);
result = zmq_setsockopt (*socket, *option_name, value, *option_len);
free(value);
return result;
}

int f77_zmq_getsockopt_ (void* *socket, int* option_name, void *option_value, int *option_len, int dummy)
Expand Down

0 comments on commit 6dc7d61

Please sign in to comment.