summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/system.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2006-09-21 08:03:56 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2006-09-21 08:03:56 +0000
commit6fe04dcbfeaaf06ae7f16a8b2d2347a77c8a78eb (patch)
tree3d5de4afedb5f43b754ccb5a61329a9418f2380d /otherlibs/win32unix/system.c
parent46391d271f27706a60b1eb55005c0f6627ad5910 (diff)
PR#4112, tentative fix
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7626 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/system.c')
-rw-r--r--otherlibs/win32unix/system.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/otherlibs/win32unix/system.c b/otherlibs/win32unix/system.c
index 725817c37..9cf3e89cc 100644
--- a/otherlibs/win32unix/system.c
+++ b/otherlibs/win32unix/system.c
@@ -26,11 +26,17 @@ CAMLprim value win_system(cmd)
{
int ret;
value st;
+ char *buf;
+ intnat len;
+ len = caml_string_length (cmd);
+ buf = caml_stat_alloc (len + 1);
+ memmove (buf, String_val (cmd), len + 1);
enter_blocking_section();
_flushall();
- ret = system(String_val(cmd));;
+ ret = system(buf);
leave_blocking_section();
+ caml_stat_free(buf);
if (ret == -1) uerror("system", Nothing);
st = alloc_small(1, 0); /* Tag 0: Exited */
Field(st, 0) = Val_int(ret);