summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/system.c
diff options
context:
space:
mode:
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);