summaryrefslogtreecommitdiff
path: root/otherlibs
diff options
context:
space:
mode:
authorDavid Allsopp <david.allsopp@metastack.com>2022-06-28 12:42:00 +0100
committerDavid Allsopp <david.allsopp@metastack.com>2022-10-14 13:27:32 +0100
commitdae49ac613348514a755b6cf7b40deea1ee07198 (patch)
tree30d37441249aa6e2daaa1378eb66b39424bba33d /otherlibs
parentd9cfe9149d7f24e5d3fa5ca9e7e451f8aa5e365f (diff)
downloadocaml-dae49ac613348514a755b6cf7b40deea1ee07198.tar.gz
Remove dead error handling in Unix.stat
Previous versions of convert_time could fail.
Diffstat (limited to 'otherlibs')
-rw-r--r--otherlibs/unix/stat_win32.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/otherlibs/unix/stat_win32.c b/otherlibs/unix/stat_win32.c
index f13df63798..231b53b981 100644
--- a/otherlibs/unix/stat_win32.c
+++ b/otherlibs/unix/stat_win32.c
@@ -155,7 +155,7 @@ static value stat_aux(int use_64, __int64 st_ino, struct _stat64 *buf)
* Microsoft CRT given in Microsoft Visual Studio 2013 Express
*/
-static int convert_time(FILETIME* time, __time64_t* result, __time64_t def)
+static void convert_time(FILETIME* time, __time64_t* result, __time64_t def)
{
/* Tempting though it may be, MSDN prohibits casting FILETIME directly
* to __int64 for alignment concerns. While this doesn't affect our supported
@@ -172,8 +172,6 @@ static int convert_time(FILETIME* time, __time64_t* result, __time64_t def)
else {
*result = def;
}
-
- return 1;
}
/* path allocated outside the OCaml heap */
@@ -294,12 +292,9 @@ static int safe_do_stat(int do_lstat, int use_64, wchar_t* path, HANDLE fstat, _
return 0;
}
- if (!convert_time(&info.ftLastWriteTime, &res->st_mtime, 0) ||
- !convert_time(&info.ftLastAccessTime, &res->st_atime, res->st_mtime) ||
- !convert_time(&info.ftCreationTime, &res->st_ctime, res->st_mtime)) {
- caml_win32_maperr(GetLastError());
- return 0;
- }
+ convert_time(&info.ftLastWriteTime, &res->st_mtime, 0);
+ convert_time(&info.ftLastAccessTime, &res->st_atime, res->st_mtime);
+ convert_time(&info.ftCreationTime, &res->st_ctime, res->st_mtime);
/*
* Note MS CRT (still) puts st_nlink = 1 and gives st_ino = 0