Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5f2e48f7
Commit
5f2e48f7
authored
Aug 21, 2013
by
Vincent Povirk
Committed by
Alexandre Julliard
Aug 22, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: _[w]access_s returns an error code.
parent
6ea59b91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
6 deletions
+92
-6
msvcr90.c
dlls/msvcr90/tests/msvcr90.c
+82
-0
file.c
dlls/msvcrt/file.c
+10
-6
No files found.
dlls/msvcr90/tests/msvcr90.c
View file @
5f2e48f7
...
...
@@ -111,6 +111,7 @@ static int (__cdecl *p_vswprintf_l)(wchar_t*, const wchar_t*, _locale_t, __ms_va
static
FILE
*
(
__cdecl
*
p_fopen
)(
const
char
*
,
const
char
*
);
static
int
(
__cdecl
*
p_fclose
)(
FILE
*
);
static
int
(
__cdecl
*
p_unlink
)(
const
char
*
);
static
int
(
__cdecl
*
p_access_s
)(
const
char
*
,
int
);
static
void
(
__cdecl
*
p_lock_file
)(
FILE
*
);
static
void
(
__cdecl
*
p_unlock_file
)(
FILE
*
);
static
int
(
__cdecl
*
p_fileno
)(
FILE
*
);
...
...
@@ -298,6 +299,7 @@ static BOOL init(void)
SET
(
p_fopen
,
"fopen"
);
SET
(
p_fclose
,
"fclose"
);
SET
(
p_unlink
,
"_unlink"
);
SET
(
p_access_s
,
"_access_s"
);
SET
(
p_lock_file
,
"_lock_file"
);
SET
(
p_unlock_file
,
"_unlock_file"
);
SET
(
p_fileno
,
"_fileno"
);
...
...
@@ -1217,6 +1219,85 @@ static void test_byteswap(void)
ok
(
ret
==
0
,
"ret = %lx
\n
"
,
ret
);
}
static
void
test_access_s
(
void
)
{
FILE
*
f
;
int
res
;
f
=
p_fopen
(
"test_file"
,
"w"
);
ok
(
f
!=
NULL
,
"unable to create test file
\n
"
);
if
(
!
f
)
return
;
p_fclose
(
f
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
0
);
ok
(
res
==
0
,
"got %x
\n
"
,
res
);
ok
(
errno
==
0xdeadbeef
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
2
);
ok
(
res
==
0
,
"got %x
\n
"
,
res
);
ok
(
errno
==
0xdeadbeef
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
4
);
ok
(
res
==
0
,
"got %x
\n
"
,
res
);
ok
(
errno
==
0xdeadbeef
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
6
);
ok
(
res
==
0
,
"got %x
\n
"
,
res
);
ok
(
errno
==
0xdeadbeef
,
"got %x
\n
"
,
res
);
SetFileAttributesA
(
"test_file"
,
FILE_ATTRIBUTE_READONLY
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
0
);
ok
(
res
==
0
,
"got %x
\n
"
,
res
);
ok
(
errno
==
0xdeadbeef
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
2
);
ok
(
res
==
EACCES
,
"got %x
\n
"
,
res
);
ok
(
errno
==
EACCES
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
4
);
ok
(
res
==
0
,
"got %x
\n
"
,
res
);
ok
(
errno
==
0xdeadbeef
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
6
);
ok
(
res
==
EACCES
,
"got %x
\n
"
,
res
);
ok
(
errno
==
EACCES
,
"got %x
\n
"
,
res
);
SetFileAttributesA
(
"test_file"
,
FILE_ATTRIBUTE_NORMAL
);
p_unlink
(
"test_file"
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
0
);
ok
(
res
==
ENOENT
,
"got %x
\n
"
,
res
);
ok
(
errno
==
ENOENT
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
2
);
ok
(
res
==
ENOENT
,
"got %x
\n
"
,
res
);
ok
(
errno
==
ENOENT
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
4
);
ok
(
res
==
ENOENT
,
"got %x
\n
"
,
res
);
ok
(
errno
==
ENOENT
,
"got %x
\n
"
,
res
);
errno
=
0xdeadbeef
;
res
=
p_access_s
(
"test_file"
,
6
);
ok
(
res
==
ENOENT
,
"got %x
\n
"
,
res
);
ok
(
errno
==
ENOENT
,
"got %x
\n
"
,
res
);
}
START_TEST
(
msvcr90
)
{
if
(
!
init
())
...
...
@@ -1242,4 +1323,5 @@ START_TEST(msvcr90)
test__vswprintf_l
();
test_nonblocking_file_access
();
test_byteswap
();
test_access_s
();
}
dlls/msvcrt/file.c
View file @
5f2e48f7
...
...
@@ -715,10 +715,12 @@ int CDECL MSVCRT__access(const char *filename, int mode)
*/
int
CDECL
_access_s
(
const
char
*
filename
,
int
mode
)
{
if
(
!
MSVCRT_CHECK_PMT
(
filename
!=
NULL
))
return
-
1
;
if
(
!
MSVCRT_CHECK_PMT
((
mode
&
~
(
MSVCRT_R_OK
|
MSVCRT_W_OK
))
==
0
))
return
-
1
;
if
(
!
MSVCRT_CHECK_PMT
(
filename
!=
NULL
))
return
*
MSVCRT__errno
()
;
if
(
!
MSVCRT_CHECK_PMT
((
mode
&
~
(
MSVCRT_R_OK
|
MSVCRT_W_OK
))
==
0
))
return
*
MSVCRT__errno
()
;
return
MSVCRT__access
(
filename
,
mode
);
if
(
MSVCRT__access
(
filename
,
mode
)
==
-
1
)
return
*
MSVCRT__errno
();
return
0
;
}
/*********************************************************************
...
...
@@ -748,10 +750,12 @@ int CDECL MSVCRT__waccess(const MSVCRT_wchar_t *filename, int mode)
*/
int
CDECL
_waccess_s
(
const
MSVCRT_wchar_t
*
filename
,
int
mode
)
{
if
(
!
MSVCRT_CHECK_PMT
(
filename
!=
NULL
))
return
-
1
;
if
(
!
MSVCRT_CHECK_PMT
((
mode
&
~
(
MSVCRT_R_OK
|
MSVCRT_W_OK
))
==
0
))
return
-
1
;
if
(
!
MSVCRT_CHECK_PMT
(
filename
!=
NULL
))
return
*
MSVCRT__errno
()
;
if
(
!
MSVCRT_CHECK_PMT
((
mode
&
~
(
MSVCRT_R_OK
|
MSVCRT_W_OK
))
==
0
))
return
*
MSVCRT__errno
()
;
return
MSVCRT__waccess
(
filename
,
mode
);
if
(
MSVCRT__waccess
(
filename
,
mode
)
==
-
1
)
return
*
MSVCRT__errno
();
return
0
;
}
/*********************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment