Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
5013de67
Commit
5013de67
authored
Dec 04, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LogInit: convert use_stdout flag to out_fd=STDOUT_FILENO
parent
9614c48e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
LogInit.cxx
src/LogInit.cxx
+6
-6
LogInit.hxx
src/LogInit.hxx
+2
-1
Main.cxx
src/Main.cxx
+7
-5
No files found.
src/LogInit.cxx
View file @
5013de67
...
@@ -130,7 +130,9 @@ log_init(bool verbose, bool use_stdout)
...
@@ -130,7 +130,9 @@ log_init(bool verbose, bool use_stdout)
SetLogThreshold
(
parse_log_level
(
param
->
value
.
c_str
(),
SetLogThreshold
(
parse_log_level
(
param
->
value
.
c_str
(),
param
->
line
));
param
->
line
));
if
(
!
use_stdout
)
{
if
(
use_stdout
)
{
out_fd
=
STDOUT_FILENO
;
}
else
{
const
auto
*
param
=
config_get_param
(
ConfigOption
::
LOG_FILE
);
const
auto
*
param
=
config_get_param
(
ConfigOption
::
LOG_FILE
);
if
(
param
==
nullptr
)
{
if
(
param
==
nullptr
)
{
/* no configuration: default to syslog (if
/* no configuration: default to syslog (if
...
@@ -171,12 +173,10 @@ log_deinit(void)
...
@@ -171,12 +173,10 @@ log_deinit(void)
#endif
#endif
}
}
void
setup_log_output
(
bool
use_stdout
)
void
setup_log_output
()
{
{
#ifdef ANDROID
#ifndef ANDROID
(
void
)
use_stdout
;
if
(
out_fd
==
STDOUT_FILENO
)
#else
if
(
use_stdout
)
return
;
return
;
fflush
(
nullptr
);
fflush
(
nullptr
);
...
...
src/LogInit.hxx
View file @
5013de67
...
@@ -40,7 +40,8 @@ log_init(bool verbose, bool use_stdout);
...
@@ -40,7 +40,8 @@ log_init(bool verbose, bool use_stdout);
void
void
log_deinit
();
log_deinit
();
void
setup_log_output
(
bool
use_stdout
);
void
setup_log_output
();
int
int
cycle_log_files
();
cycle_log_files
();
...
...
src/Main.cxx
View file @
5013de67
...
@@ -382,7 +382,8 @@ int main(int argc, char *argv[])
...
@@ -382,7 +382,8 @@ int main(int argc, char *argv[])
#endif
#endif
static
int
mpd_main_after_fork
(
struct
options
);
static
int
mpd_main_after_fork
();
#ifdef ANDROID
#ifdef ANDROID
static
inline
static
inline
...
@@ -467,19 +468,20 @@ try {
...
@@ -467,19 +468,20 @@ try {
This must be run after forking; if dispatch is called before forking,
This must be run after forking; if dispatch is called before forking,
the child process will have a broken internal dispatch state. */
the child process will have a broken internal dispatch state. */
dispatch_async
(
dispatch_get_global_queue
(
DISPATCH_QUEUE_PRIORITY_DEFAULT
,
0
),
^
{
dispatch_async
(
dispatch_get_global_queue
(
DISPATCH_QUEUE_PRIORITY_DEFAULT
,
0
),
^
{
exit
(
mpd_main_after_fork
(
options
));
exit
(
mpd_main_after_fork
());
});
});
dispatch_main
();
dispatch_main
();
return
EXIT_FAILURE
;
// unreachable, because dispatch_main never returns
return
EXIT_FAILURE
;
// unreachable, because dispatch_main never returns
#else
#else
return
mpd_main_after_fork
(
options
);
return
mpd_main_after_fork
();
#endif
#endif
}
catch
(
const
std
::
exception
&
e
)
{
}
catch
(
const
std
::
exception
&
e
)
{
LogError
(
e
);
LogError
(
e
);
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
static
int
mpd_main_after_fork
(
struct
options
options
)
static
int
mpd_main_after_fork
()
try
{
try
{
ConfigureFS
();
ConfigureFS
();
...
@@ -514,7 +516,7 @@ try {
...
@@ -514,7 +516,7 @@ try {
#endif
#endif
#ifndef ANDROID
#ifndef ANDROID
setup_log_output
(
options
.
log_stderr
);
setup_log_output
();
SignalHandlersInit
(
instance
->
event_loop
);
SignalHandlersInit
(
instance
->
event_loop
);
#endif
#endif
...
...
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