Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
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
Chen Yisong
lxc
Commits
ae07a9bf
Commit
ae07a9bf
authored
Feb 15, 2016
by
Christian Brauner
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #821 from hallyn/2016-02-15/lognull
2016 02 15/lognull
parents
bad548de
d9c9b180
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
log.c
src/lxc/log.c
+15
-13
No files found.
src/lxc/log.c
View file @
ae07a9bf
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
* License along with this library; if not, write to the Free Software
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include <assert.h>
#include <stdio.h>
#include <stdio.h>
#include <errno.h>
#include <errno.h>
#include <limits.h>
#include <limits.h>
...
@@ -252,6 +253,16 @@ static char *build_log_path(const char *name, const char *lxcpath)
...
@@ -252,6 +253,16 @@ static char *build_log_path(const char *name, const char *lxcpath)
return
p
;
return
p
;
}
}
extern
void
lxc_log_close
(
void
)
{
if
(
lxc_log_fd
==
-
1
)
return
;
close
(
lxc_log_fd
);
lxc_log_fd
=
-
1
;
free
(
log_fname
);
log_fname
=
NULL
;
}
/*
/*
* This can be called:
* This can be called:
* 1. when a program calls lxc_log_init with no logfile parameter (in which
* 1. when a program calls lxc_log_init with no logfile parameter (in which
...
@@ -264,11 +275,12 @@ static int __lxc_log_set_file(const char *fname, int create_dirs)
...
@@ -264,11 +275,12 @@ static int __lxc_log_set_file(const char *fname, int create_dirs)
{
{
if
(
lxc_log_fd
!=
-
1
)
{
if
(
lxc_log_fd
!=
-
1
)
{
// we are overriding the default.
// we are overriding the default.
close
(
lxc_log_fd
);
lxc_log_close
();
free
(
log_fname
);
}
}
if
(
!
fname
||
strlen
(
fname
)
==
0
)
{
assert
(
fname
!=
NULL
);
if
(
strlen
(
fname
)
==
0
)
{
log_fname
=
NULL
;
log_fname
=
NULL
;
return
0
;
return
0
;
}
}
...
@@ -380,16 +392,6 @@ extern int lxc_log_init(const char *name, const char *file,
...
@@ -380,16 +392,6 @@ extern int lxc_log_init(const char *name, const char *file,
return
ret
;
return
ret
;
}
}
extern
void
lxc_log_close
(
void
)
{
if
(
lxc_log_fd
==
-
1
)
return
;
close
(
lxc_log_fd
);
lxc_log_fd
=
-
1
;
free
(
log_fname
);
log_fname
=
NULL
;
}
/*
/*
* This is called when we read a lxc.loglevel entry in a lxc.conf file. This
* This is called when we read a lxc.loglevel entry in a lxc.conf file. This
* happens after processing command line arguments, which override the .conf
* happens after processing command line arguments, which override the .conf
...
...
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