msvcrt: Set errno in _lseeki64.
Signed-off-by: Daniel Lehman <dlehman@esri.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
54f4bfb06d
commit
44b49f1a40
|
@ -1265,6 +1265,7 @@ __int64 CDECL MSVCRT__lseeki64(int fd, __int64 offset, int whence)
|
|||
|
||||
if (info->handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
*MSVCRT__errno() = MSVCRT_EBADF;
|
||||
release_ioinfo(info);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -2583,6 +2583,31 @@ static void test__creat(void)
|
|||
p__set_fmode(old_fmode);
|
||||
}
|
||||
|
||||
static void test_lseek(void)
|
||||
{
|
||||
int fd;
|
||||
char testdata[4] = {'a', '\n', 'b', '\n'};
|
||||
|
||||
errno = 0xdeadbeef;
|
||||
ok(_lseek(-42, 0, SEEK_SET) == -1, "expected failure\n");
|
||||
ok(errno == EBADF, "errno = %d\n", errno);
|
||||
|
||||
fd = _creat("_creat.tst", _S_IWRITE);
|
||||
ok(fd > 0, "_creat failed\n");
|
||||
_write(fd, testdata, 4);
|
||||
|
||||
errno = 0xdeadbeef;
|
||||
ok(_lseek(fd, 0, 42) == -1, "expected failure\n");
|
||||
ok(errno == EINVAL, "errno = %d\n", errno);
|
||||
|
||||
errno = 0xdeadbeef;
|
||||
ok(_lseek(fd, -42, SEEK_SET) == -1, "expected failure\n");
|
||||
ok(errno == EINVAL, "errno = %d\n", errno);
|
||||
|
||||
_close(fd);
|
||||
DeleteFileA("_creat.tst");
|
||||
}
|
||||
|
||||
START_TEST(file)
|
||||
{
|
||||
int arg_c;
|
||||
|
@ -2654,6 +2679,7 @@ START_TEST(file)
|
|||
test_write_flush();
|
||||
test_close();
|
||||
test__creat();
|
||||
test_lseek();
|
||||
|
||||
/* Wait for the (_P_NOWAIT) spawned processes to finish to make sure the report
|
||||
* file contains lines in the correct order
|
||||
|
|
Loading…
Reference in New Issue