master
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#include <sys/stat.h>
8
9/* When the file size does not fit into the st_size field:
10 * crtdll-msvcr90 msvcr100 msvcr110+
11 * st_size truncate 0 0
12 * errno no change no change EOVERFLOW
13 * returns 0 -1 -1
14 *
15 * This file is used only for pre-msvcr80 builds,
16 * So use the pre-msvcr80 behavior - truncate without error.
17 */
18int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat)
19{
20 struct _stat64 st;
21 int ret=_wstat64(_Name,&st);
22 if (ret != 0)
23 return ret;
24 _Stat->st_dev=st.st_dev;
25 _Stat->st_ino=st.st_ino;
26 _Stat->st_mode=st.st_mode;
27 _Stat->st_nlink=st.st_nlink;
28 _Stat->st_uid=st.st_uid;
29 _Stat->st_gid=st.st_gid;
30 _Stat->st_rdev=st.st_rdev;
31 _Stat->st_size=(_off_t) st.st_size; /* truncate 64-bit st_size to 32-bit */
32 _Stat->st_atime=st.st_atime;
33 _Stat->st_mtime=st.st_mtime;
34 _Stat->st_ctime=st.st_ctime;
35 return 0;
36}
37int (__cdecl *__MINGW_IMP_SYMBOL(_wstat64i32))(const wchar_t *, struct _stat64i32 *) = _wstat64i32;