diff options
author | Micael Karlberg <[email protected]> | 2019-05-15 17:49:05 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-05-29 13:47:40 +0200 |
commit | 3ec5549972b672b0d177fb1eeb89addf184c13ef (patch) | |
tree | 2366cb4deddd2daceac9858b0973c0287c7e2354 | |
parent | 8ade89da0715e3b99e300429d10dca43aeac1f9d (diff) | |
download | otp-3ec5549972b672b0d177fb1eeb89addf184c13ef.tar.gz otp-3ec5549972b672b0d177fb1eeb89addf184c13ef.tar.bz2 otp-3ec5549972b672b0d177fb1eeb89addf184c13ef.zip |
[esock] Fixed 'typing' of type timeval on darwin
-rw-r--r-- | erts/emulator/nifs/common/socket_util.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/erts/emulator/nifs/common/socket_util.c b/erts/emulator/nifs/common/socket_util.c index 4ba48afcfa..2740cb51ef 100644 --- a/erts/emulator/nifs/common/socket_util.c +++ b/erts/emulator/nifs/common/socket_util.c @@ -986,9 +986,27 @@ char* esock_decode_timeval(ErlNifEnv* env, if (!GET_LONG(env, eSec, &timeP->tv_sec)) return ESOCK_STR_EINVAL; +#if (SIZEOF_INT == 4) + { + int usec; + if (!GET_INT(env, eUSec, &usec)) + return ESOCK_STR_EINVAL; + timeP->tv_usec = (typeof(timeP->tv_usec)) usec; + } +#elif (SIZEOF_LONG == 4) + { + long usec; + if (!GET_LONG(env, eUSec, &usec)) + return ESOCK_STR_EINVAL; + timeP->tv_usec = (typeof(timeP->tv_usec)) usec; + } +#else + /* Ok, we give up... */ if (!GET_LONG(env, eUSec, &timeP->tv_usec)) return ESOCK_STR_EINVAL; +#endif + return NULL; } |