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
471782ae
Commit
471782ae
authored
Jan 25, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Allow opening a directory with write access (based on a patch
by Mike McCormack).
parent
cf675c11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
15 deletions
+21
-15
fd.c
server/fd.c
+20
-3
file.c
server/file.c
+1
-12
No files found.
server/fd.c
View file @
471782ae
...
...
@@ -1327,6 +1327,7 @@ struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int acce
struct
closed_fd
*
closed_fd
;
struct
fd
*
fd
;
const
char
*
unlink_name
=
""
;
int
rw_mode
;
if
(
!
(
fd
=
alloc_fd_object
()))
return
NULL
;
...
...
@@ -1336,6 +1337,7 @@ struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int acce
release_object
(
fd
);
return
NULL
;
}
/* create the directory if needed */
if
((
options
&
FILE_DIRECTORY_FILE
)
&&
(
flags
&
O_CREAT
))
{
...
...
@@ -1349,11 +1351,26 @@ struct fd *open_fd( const char *name, int flags, mode_t *mode, unsigned int acce
}
flags
&=
~
(
O_CREAT
|
O_EXCL
|
O_TRUNC
);
}
if
((
fd
->
unix_fd
=
open
(
name
,
flags
&
~
O_TRUNC
,
*
mode
))
==
-
1
)
if
((
access
&
FILE_UNIX_WRITE_ACCESS
)
&&
!
(
options
&
FILE_DIRECTORY_FILE
))
{
if
(
access
&
FILE_UNIX_READ_ACCESS
)
rw_mode
=
O_RDWR
;
else
rw_mode
=
O_WRONLY
;
}
else
rw_mode
=
O_RDONLY
;
if
((
fd
->
unix_fd
=
open
(
name
,
rw_mode
|
(
flags
&
~
O_TRUNC
),
*
mode
))
==
-
1
)
{
file_set_error
();
goto
error
;
/* 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
),
*
mode
))
==
-
1
)
{
file_set_error
();
goto
error
;
}
}
closed_fd
->
unix_fd
=
fd
->
unix_fd
;
closed_fd
->
unlink
[
0
]
=
0
;
fstat
(
fd
->
unix_fd
,
&
st
);
...
...
server/file.c
View file @
471782ae
...
...
@@ -141,7 +141,7 @@ static struct object *create_file( const char *nameptr, size_t len, unsigned int
{
struct
object
*
obj
=
NULL
;
struct
fd
*
fd
;
int
flags
,
rw_mode
;
int
flags
;
char
*
name
;
mode_t
mode
;
...
...
@@ -168,17 +168,6 @@ static struct object *create_file( const char *nameptr, size_t len, unsigned int
access
=
generic_file_map_access
(
access
);
rw_mode
=
0
;
if
(
access
&
FILE_UNIX_READ_ACCESS
)
rw_mode
|=
FILE_READ_DATA
;
if
(
access
&
FILE_UNIX_WRITE_ACCESS
)
rw_mode
|=
FILE_WRITE_DATA
;
switch
(
rw_mode
)
{
case
0
:
break
;
case
FILE_READ_DATA
:
flags
|=
O_RDONLY
;
break
;
case
FILE_WRITE_DATA
:
flags
|=
O_WRONLY
;
break
;
case
FILE_READ_DATA
|
FILE_WRITE_DATA
:
flags
|=
O_RDWR
;
break
;
}
/* FIXME: should set error to STATUS_OBJECT_NAME_COLLISION if file existed before */
fd
=
open_fd
(
name
,
flags
|
O_NONBLOCK
|
O_LARGEFILE
,
&
mode
,
access
,
sharing
,
options
);
if
(
!
fd
)
goto
done
;
...
...
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