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
09ee60c6
Commit
09ee60c6
authored
Jun 24, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1670 from arrbee/open-cloexec
Add O_CLOEXEC to open calls
parents
6c4dadba
3d3ea4dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
src/fileops.c
+4
-2
src/posix.c
+2
-2
src/posix.h
+3
-0
No files found.
src/fileops.c
View file @
09ee60c6
...
...
@@ -61,9 +61,11 @@ int git_futils_creat_locked(const char *path, const mode_t mode)
wchar_t
buf
[
GIT_WIN_PATH
];
git__utf8_to_16
(
buf
,
GIT_WIN_PATH
,
path
);
fd
=
_wopen
(
buf
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_BINARY
|
O_EXCL
,
mode
);
fd
=
_wopen
(
buf
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_EXCL
|
O_BINARY
|
O_CLOEXEC
,
mode
);
#else
fd
=
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_BINARY
|
O_EXCL
,
mode
);
fd
=
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_EXCL
|
O_BINARY
|
O_CLOEXEC
,
mode
);
#endif
if
(
fd
<
0
)
{
...
...
src/posix.c
View file @
09ee60c6
...
...
@@ -111,12 +111,12 @@ int p_open(const char *path, int flags, ...)
va_end
(
arg_list
);
}
return
open
(
path
,
flags
|
O_BINARY
,
mode
);
return
open
(
path
,
flags
|
O_BINARY
|
O_CLOEXEC
,
mode
);
}
int
p_creat
(
const
char
*
path
,
mode_t
mode
)
{
return
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_BINARY
,
mode
);
return
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_BINARY
|
O_CLOEXEC
,
mode
);
}
int
p_getcwd
(
char
*
buffer_out
,
size_t
size
)
...
...
src/posix.h
View file @
09ee60c6
...
...
@@ -25,6 +25,9 @@
#if !defined(O_BINARY)
#define O_BINARY 0
#endif
#if !defined(O_CLOEXEC)
#define O_CLOEXEC 0
#endif
typedef
int
git_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