Skip to content

Commit ef86247

Browse files
authored
Merge pull request #14 from scemama/master
Better handling of setsockopt
2 parents e409e37 + 6dc7d61 commit ef86247

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

f77_zmq.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,12 @@ int f77_zmq_disconnect_ (void* *socket, char* address_in, int address_len)
207207

208208
int f77_zmq_setsockopt_ (void* *socket, int* option_name, void* option_value, int* option_len, int dummy)
209209
{
210-
return zmq_setsockopt (*socket, *option_name, option_value, *option_len);
210+
int result;
211+
void * value = malloc(*option_len);
212+
memcpy(value, option_value, (size_t) *option_len);
213+
result = zmq_setsockopt (*socket, *option_name, value, *option_len);
214+
free(value);
215+
return result;
211216
}
212217

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

0 commit comments

Comments
 (0)