Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
151446a2
Commit
151446a2
authored
Dec 08, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Improve parameter checks when opening a directory.
parent
019e4049
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
fd.c
server/fd.c
+19
-5
No files found.
server/fd.c
View file @
151446a2
...
...
@@ -1732,7 +1732,8 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
int
root_fd
=
-
1
;
int
rw_mode
;
if
((
options
&
FILE_DELETE_ON_CLOSE
)
&&
!
(
access
&
DELETE
))
if
(((
options
&
FILE_DELETE_ON_CLOSE
)
&&
!
(
access
&
DELETE
))
||
((
options
&
FILE_DIRECTORY_FILE
)
&&
(
flags
&
O_TRUNC
)))
{
set_error
(
STATUS_INVALID_PARAMETER
);
return
NULL
;
...
...
@@ -1785,9 +1786,13 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
if
((
fd
->
unix_fd
=
open
(
name
,
rw_mode
|
(
flags
&
~
O_TRUNC
),
*
mode
))
==
-
1
)
{
/* if we tried to open a directory for write access, retry read-only */
if
(
errno
!=
EISDIR
||
!
(
access
&
FILE_UNIX_WRITE_ACCESS
)
||
(
fd
->
unix_fd
=
open
(
name
,
O_RDONLY
|
(
flags
&
~
(
O_TRUNC
|
O_CREAT
|
O_EXCL
)),
*
mode
))
==
-
1
)
if
(
errno
==
EISDIR
)
{
if
((
access
&
FILE_UNIX_WRITE_ACCESS
)
||
(
flags
&
O_CREAT
))
fd
->
unix_fd
=
open
(
name
,
O_RDONLY
|
(
flags
&
~
(
O_TRUNC
|
O_CREAT
|
O_EXCL
)),
*
mode
);
}
if
(
fd
->
unix_fd
==
-
1
)
{
file_set_error
();
goto
error
;
...
...
@@ -1836,7 +1841,16 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
return
NULL
;
}
strcpy
(
closed_fd
->
unlink
,
unlink_name
);
if
(
flags
&
O_TRUNC
)
ftruncate
(
fd
->
unix_fd
,
0
);
if
(
flags
&
O_TRUNC
)
{
if
(
S_ISDIR
(
st
.
st_mode
))
{
release_object
(
fd
);
set_error
(
STATUS_OBJECT_NAME_COLLISION
);
return
NULL
;
}
ftruncate
(
fd
->
unix_fd
,
0
);
}
}
else
/* special file */
{
...
...
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