mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 12:31:51 +00:00
[CRT] Update file descriptor handling to match Wine (3/7). CORE-14504
Import Wine commits by Piotr Caban: * 6c2d4f1092d msvcrt: Use fd critical section in _fstat64. * 9278190d468 msvcrt: Use fd critical section in _futime64.
This commit is contained in:
parent
9eb1eae28c
commit
c529e727d7
4 changed files with 35 additions and 23 deletions
|
@ -39,8 +39,10 @@
|
|||
#include <time.h>
|
||||
#include <sys/utime.h>
|
||||
#include "bitsfixup.h"
|
||||
#include <internal/wine/msvcrt.h>
|
||||
|
||||
HANDLE fdtoh(int fd);
|
||||
inline ioinfo* get_ioinfo(int fd);
|
||||
inline void release_ioinfo(ioinfo *info);
|
||||
|
||||
/******************************************************************************
|
||||
* \name _futime
|
||||
|
@ -52,12 +54,12 @@ HANDLE fdtoh(int fd);
|
|||
int
|
||||
_futime(int fd, struct _utimbuf *filetime)
|
||||
{
|
||||
HANDLE handle;
|
||||
ioinfo *info = get_ioinfo(fd);
|
||||
FILETIME at, wt;
|
||||
|
||||
handle = fdtoh(fd);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
if (info->handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
release_ioinfo(info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -84,11 +86,12 @@ _futime(int fd, struct _utimbuf *filetime)
|
|||
}
|
||||
}
|
||||
|
||||
if (!SetFileTime(handle, NULL, &at, &wt))
|
||||
if (!SetFileTime(info->handle, NULL, &at, &wt))
|
||||
{
|
||||
release_ioinfo(info);
|
||||
_dosmaperr(GetLastError());
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
release_ioinfo(info);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue