Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
57085c89
Commit
57085c89
authored
Nov 04, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exclude from compilation prevent_child_fd() if SPDLOG_PREVENT_CHILD_FD not defined
parent
d67efb2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
include/spdlog/details/os-inl.h
include/spdlog/details/os-inl.h
+3
-3
include/spdlog/details/os.h
include/spdlog/details/os.h
+2
-0
No files found.
include/spdlog/details/os-inl.h
View file @
57085c89
...
...
@@ -126,15 +126,13 @@ SPDLOG_INLINE std::tm gmtime() SPDLOG_NOEXCEPT
return
gmtime
(
now_t
);
}
#ifdef SPDLOG_PREVENT_CHILD_FD
SPDLOG_INLINE
void
prevent_child_fd
(
FILE
*
f
)
{
#ifdef _WIN32
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
auto
file_handle
=
reinterpret_cast
<
HANDLE
>
(
_get_osfhandle
(
::
_fileno
(
f
)));
if
(
!::
SetHandleInformation
(
file_handle
,
HANDLE_FLAG_INHERIT
,
0
))
SPDLOG_THROW
(
spdlog_ex
(
"SetHandleInformation failed"
,
errno
));
#endif
#else
auto
fd
=
::
fileno
(
f
);
if
(
::
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
)
==
-
1
)
...
...
@@ -143,6 +141,7 @@ SPDLOG_INLINE void prevent_child_fd(FILE *f)
}
#endif
}
#endif //SPDLOG_PREVENT_CHILD_FD
// fopen_s on non windows for writing
SPDLOG_INLINE
bool
fopen_s
(
FILE
**
fp
,
const
filename_t
&
filename
,
const
filename_t
&
mode
)
...
...
@@ -158,6 +157,7 @@ SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename
#endif
#ifdef SPDLOG_PREVENT_CHILD_FD
// prevent child processes from inheriting log file descriptors
if
(
*
fp
!=
nullptr
)
{
prevent_child_fd
(
*
fp
);
...
...
include/spdlog/details/os.h
View file @
57085c89
...
...
@@ -38,7 +38,9 @@ static const char folder_sep = '\\';
SPDLOG_CONSTEXPR
static
const
char
folder_sep
=
'/'
;
#endif
#ifdef SPDLOG_PREVENT_CHILD_FD
void
prevent_child_fd
(
FILE
*
f
);
#endif
// fopen_s on non windows for writing
bool
fopen_s
(
FILE
**
fp
,
const
filename_t
&
filename
,
const
filename_t
&
mode
);
...
...
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