niXman | 32ec57d | 2017-08-03 13:01:04 +0300 | [diff] [blame] | 1 | /** |
Pali Rohár | c98e4bb | 2025-04-13 18:34:33 +0200 | [diff] [blame] | 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. |
niXman | 32ec57d | 2017-08-03 13:01:04 +0300 | [diff] [blame] | 5 | */ |
| 6 | |
Pali Rohár | c98e4bb | 2025-04-13 18:34:33 +0200 | [diff] [blame] | 7 | #include <sys/stat.h> |
niXman | 32ec57d | 2017-08-03 13:01:04 +0300 | [diff] [blame] | 8 | |
Pali Rohár | c98e4bb | 2025-04-13 18:34:33 +0200 | [diff] [blame] | 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 | */ |
Ozkan Sezer | 1da96b0 | 2009-08-21 09:03:49 +0000 | [diff] [blame] | 18 | int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat) |
| 19 | { |
| 20 | struct _stat64 st; |
Pali Rohár | c98e4bb | 2025-04-13 18:34:33 +0200 | [diff] [blame] | 21 | int ret=_wstat64(_Name,&st); |
| 22 | if (ret != 0) |
| 23 | return ret; |
Ozkan Sezer | 1da96b0 | 2009-08-21 09:03:49 +0000 | [diff] [blame] | 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; |
Pali Rohár | c98e4bb | 2025-04-13 18:34:33 +0200 | [diff] [blame] | 31 | _Stat->st_size=(_off_t) st.st_size; /* truncate 64-bit st_size to 32-bit */ |
Ozkan Sezer | 1da96b0 | 2009-08-21 09:03:49 +0000 | [diff] [blame] | 32 | _Stat->st_atime=st.st_atime; |
| 33 | _Stat->st_mtime=st.st_mtime; |
| 34 | _Stat->st_ctime=st.st_ctime; |
Pali Rohár | c98e4bb | 2025-04-13 18:34:33 +0200 | [diff] [blame] | 35 | return 0; |
Ozkan Sezer | 1da96b0 | 2009-08-21 09:03:49 +0000 | [diff] [blame] | 36 | } |
Pali Rohár | c98e4bb | 2025-04-13 18:34:33 +0200 | [diff] [blame] | 37 | int (__cdecl *__MINGW_IMP_SYMBOL(_wstat64i32))(const wchar_t *, struct _stat64i32 *) = _wstat64i32; |