summary refs log tree commit diff stats
path: root/lib/deprecated
diff options
context:
space:
mode:
authorRuslan Mustakov <ruslan.mustakov@xored.com>2016-06-22 20:50:18 +0600
committerRuslan Mustakov <ruslan.mustakov@xored.com>2016-06-22 20:50:18 +0600
commit45f76738ee6643cf434eb1f7326ad8ad40c344f9 (patch)
tree20458a21a7da2cbd1e10670ddec8a65bdb4e0608 /lib/deprecated
parent4b0ba5e3f1b78b3c45a3f1576ed3d60f9a8b6d80 (diff)
downloadNim-45f76738ee6643cf434eb1f7326ad8ad40c344f9.tar.gz
Added 'android4' define support that declares a different gethostbyaddr. Fixes #4376
Diffstat (limited to 'lib/deprecated')
-rw-r--r--lib/deprecated/pure/sockets.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/deprecated/pure/sockets.nim b/lib/deprecated/pure/sockets.nim
index 20e6d9364..34c2e7a7d 100644
--- a/lib/deprecated/pure/sockets.nim
+++ b/lib/deprecated/pure/sockets.nim
@@ -711,8 +711,13 @@ proc getHostByAddr*(ip: string): Hostent {.tags: [ReadIOEffect].} =
                                   cint(sockets.AF_INET))
     if s == nil: raiseOSError(osLastError())
   else:
-    var s = posix.gethostbyaddr(addr(myaddr), sizeof(myaddr).Socklen,
-                                cint(posix.AF_INET))
+    var s =
+      when defined(android4):
+        posix.gethostbyaddr(cast[cstring](addr(myaddr)), sizeof(myaddr).cint,
+                            cint(posix.AF_INET))
+      else:
+        posix.gethostbyaddr(addr(myaddr), sizeof(myaddr).Socklen,
+                            cint(posix.AF_INET))
     if s == nil:
       raiseOSError(osLastError(), $hstrerror(h_errno))