Permalink
Browse files

#6273: fix Sys.file_exists on large files for Win32 (patch by C. Bauer).

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14652 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
alainfrisch committed Apr 22, 2014
1 parent 44845c5 commit 456ad30a5445f3b5e1b5ca8922ff7d326056e049
Showing with 18 additions and 0 deletions.
  1. +2 −0 Changes
  2. +16 −0 byterun/sys.c
View
@@ -77,6 +77,8 @@ OCamldoc:
record fields
- PR#6310: fix ocamldoc's subscript/superscript CSS font size
(patch by Anil Madhavapeddy)
+- PR#6273: fix Sys.file_exists on large files (Win32)
+ (patch by Christoph Bauer)
Bug fixes:
- PR#4719: Sys.executable_name wrong if executable name contains dots (Windows)
View
@@ -152,13 +152,21 @@ CAMLprim value caml_sys_close(value fd)
CAMLprim value caml_sys_file_exists(value name)
{
+#ifdef _WIN32
+ struct _stati64 st;
+#else
struct stat st;
+#endif
char * p;
int ret;
p = caml_strdup(String_val(name));
caml_enter_blocking_section();
+#ifdef _WIN32
ret = stat(p, &st);
+#else
+ ret = _stati64(p, &st);
+#endif
caml_leave_blocking_section();
caml_stat_free(p);
@@ -168,13 +176,21 @@ CAMLprim value caml_sys_file_exists(value name)
CAMLprim value caml_sys_is_directory(value name)
{
CAMLparam1(name);
+#ifdef _WIN32
+ struct _stati64 st;
+#else
struct stat st;
+#endif
char * p;
int ret;
p = caml_strdup(String_val(name));
caml_enter_blocking_section();
+#ifdef _WIN32
ret = stat(p, &st);
+#else
+ ret = _stati64(p, &st);
+#endif
caml_leave_blocking_section();
caml_stat_free(p);

0 comments on commit 456ad30

Please sign in to comment.