Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
57f45e7f
Commit
57f45e7f
authored
Feb 13, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2901 from ethomson/win32_mode_bits
win32: limit the mode to `_wopen`/`_waccess`
parents
0b2ee7c0
527ed59a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
src/win32/posix_w32.c
+11
-3
No files found.
src/win32/posix_w32.c
View file @
57f45e7f
...
...
@@ -33,6 +33,12 @@
* inheritable on Windows, so specify the flag to get default behavior back. */
#define STANDARD_OPEN_FLAGS (_O_BINARY | _O_NOINHERIT)
/* Allowable mode bits on Win32. Using mode bits that are not supported on
* Win32 (eg S_IRWXU) is generally ignored, but Wine warns loudly about it
* so we simply remove them.
*/
#define WIN32_MODE_MASK (_S_IREAD | _S_IWRITE)
/* GetFinalPathNameByHandleW signature */
typedef
DWORD
(
WINAPI
*
PFGetFinalPathNameByHandleW
)(
HANDLE
,
LPWSTR
,
DWORD
,
DWORD
);
...
...
@@ -343,7 +349,7 @@ int p_open(const char *path, int flags, ...)
va_end
(
arg_list
);
}
return
_wopen
(
buf
,
flags
|
STANDARD_OPEN_FLAGS
,
mode
);
return
_wopen
(
buf
,
flags
|
STANDARD_OPEN_FLAGS
,
mode
&
WIN32_MODE_MASK
);
}
int
p_creat
(
const
char
*
path
,
mode_t
mode
)
...
...
@@ -353,7 +359,9 @@ int p_creat(const char *path, mode_t mode)
if
(
git_win32_path_from_utf8
(
buf
,
path
)
<
0
)
return
-
1
;
return
_wopen
(
buf
,
_O_WRONLY
|
_O_CREAT
|
_O_TRUNC
|
STANDARD_OPEN_FLAGS
,
mode
);
return
_wopen
(
buf
,
_O_WRONLY
|
_O_CREAT
|
_O_TRUNC
|
STANDARD_OPEN_FLAGS
,
mode
&
WIN32_MODE_MASK
);
}
int
p_getcwd
(
char
*
buffer_out
,
size_t
size
)
...
...
@@ -607,7 +615,7 @@ int p_access(const char* path, mode_t mode)
if
(
git_win32_path_from_utf8
(
buf
,
path
)
<
0
)
return
-
1
;
return
_waccess
(
buf
,
mode
);
return
_waccess
(
buf
,
mode
&
WIN32_MODE_MASK
);
}
static
int
ensure_writable
(
wchar_t
*
fpath
)
...
...
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