mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-07 20:42:09 -05:00
tst: passthrough-fuse: testing
This commit is contained in:
parent
206b85c278
commit
9c2b4e5631
@ -240,15 +240,14 @@ int close(int fd)
|
|||||||
|
|
||||||
int lstat(const char *path, struct fuse_stat *stbuf)
|
int lstat(const char *path, struct fuse_stat *stbuf)
|
||||||
{
|
{
|
||||||
int res = -1;
|
HANDLE h = CreateFileA(path,
|
||||||
int fd;
|
FILE_READ_ATTRIBUTES, 0, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||||
|
if (INVALID_HANDLE_VALUE == h)
|
||||||
|
return error();
|
||||||
|
|
||||||
fd = open(path, O_RDONLY);
|
int res = fstat((int)(intptr_t)h, stbuf);
|
||||||
if (-1 != fd)
|
|
||||||
{
|
CloseHandle(h);
|
||||||
res = fstat(fd, stbuf);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -267,36 +266,32 @@ int lchown(const char *path, fuse_uid_t uid, fuse_gid_t gid)
|
|||||||
|
|
||||||
int truncate(const char *path, fuse_off_t size)
|
int truncate(const char *path, fuse_off_t size)
|
||||||
{
|
{
|
||||||
int res = -1;
|
HANDLE h = CreateFileA(path,
|
||||||
int fd;
|
FILE_WRITE_DATA, 0, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||||
|
if (INVALID_HANDLE_VALUE == h)
|
||||||
|
return error();
|
||||||
|
|
||||||
fd = open(path, O_WRONLY);
|
int res = ftruncate((int)(intptr_t)h, size);
|
||||||
if (-1 != fd)
|
|
||||||
{
|
CloseHandle(h);
|
||||||
res = ftruncate(fd, size);
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int utime(const char *path, const struct fuse_utimbuf *timbuf)
|
int utime(const char *path, const struct fuse_utimbuf *timbuf)
|
||||||
{
|
{
|
||||||
int res = -1;
|
HANDLE h = CreateFileA(path,
|
||||||
int fd;
|
FILE_WRITE_DATA, 0, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||||
UINT64 LastAccessTime, LastWriteTime;
|
if (INVALID_HANDLE_VALUE == h)
|
||||||
|
return error();
|
||||||
|
|
||||||
fd = open(path, O_WRONLY);
|
UINT64 LastAccessTime = timbuf->actime * 10000000 + 116444736000000000;
|
||||||
if (-1 != fd)
|
UINT64 LastWriteTime = timbuf->modtime * 10000000 + 116444736000000000;
|
||||||
{
|
|
||||||
LastAccessTime = timbuf->actime * 10000000 + 116444736000000000;
|
|
||||||
LastWriteTime = timbuf->modtime * 10000000 + 116444736000000000;
|
|
||||||
|
|
||||||
res = SetFileTime((HANDLE)(intptr_t)fd,
|
int res = SetFileTime(h,
|
||||||
0, (PFILETIME)&LastAccessTime, (PFILETIME)&LastWriteTime) ? 0 : error();
|
0, (PFILETIME)&LastAccessTime, (PFILETIME)&LastWriteTime) ? 0 : error();
|
||||||
|
|
||||||
close(fd);
|
CloseHandle(h);
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user