summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/gethost.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/unix/gethost.c')
-rw-r--r--otherlibs/unix/gethost.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/otherlibs/unix/gethost.c b/otherlibs/unix/gethost.c
index e155152f8..607b6c35f 100644
--- a/otherlibs/unix/gethost.c
+++ b/otherlibs/unix/gethost.c
@@ -127,8 +127,7 @@ CAMLprim value unix_gethostbyname(value name)
char * hostname;
#if HAS_GETHOSTBYNAME_R || GETHOSTBYNAME_IS_REENTRANT
- hostname = caml_stat_alloc(string_length(name) + 1);
- strcpy(hostname, String_val(name));
+ hostname = caml_stat_alloc_string(name);
#else
hostname = String_val(name);
#endif