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
ee25a44f
Commit
ee25a44f
authored
Apr 30, 2013
by
Dwight Engen
Committed by
Serge Hallyn
Apr 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log.c: always use dir when lxcpath is not default
Signed-off-by:
Dwight Engen
<
dwight.engen@oracle.com
>
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
b338c81b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
log.c
src/lxc/log.c
+23
-13
No files found.
src/lxc/log.c
View file @
ee25a44f
...
@@ -187,31 +187,41 @@ static int log_open(const char *name)
...
@@ -187,31 +187,41 @@ static int log_open(const char *name)
static
char
*
build_log_path
(
const
char
*
name
,
const
char
*
lxcpath
)
static
char
*
build_log_path
(
const
char
*
name
,
const
char
*
lxcpath
)
{
{
char
*
p
;
char
*
p
;
int
len
,
ret
;
int
len
,
ret
,
use_dir
;
#if USE_CONFIGPATH_LOGS
use_dir
=
1
;
#else
use_dir
=
0
;
#endif
/*
/*
* If USE_CONFIGPATH_LOGS is true the resulting path will be:
* If USE_CONFIGPATH_LOGS is true or lxcpath is given, the resulting
* path will be:
* '$logpath' + '/' + '$name' + '/' + '$name' + '.log' + '\0'
* '$logpath' + '/' + '$name' + '/' + '$name' + '.log' + '\0'
*
*
* If USE_CONFIGPATH_LOGS is false the resulting path will be:
* If USE_CONFIGPATH_LOGS is false the resulting path will be:
* '$logpath' + '/' + '$name' + '.log' + '\0'
* '$logpath' + '/' + '$name' + '.log' + '\0'
*/
*/
len
=
strlen
(
name
)
+
6
;
/* 6 == '/' + '.log' + '\0' */
len
=
strlen
(
name
)
+
6
;
/* 6 == '/' + '.log' + '\0' */
if
(
!
lxcpath
)
if
(
lxcpath
)
use_dir
=
1
;
else
lxcpath
=
LOGPATH
;
lxcpath
=
LOGPATH
;
#if USE_CONFIGPATH_LOGS
len
+=
strlen
(
lxcpath
)
+
1
+
strlen
(
name
)
+
1
;
/* add "/$container_name/" */
if
(
use_dir
)
#else
len
+=
strlen
(
lxcpath
)
+
1
+
strlen
(
name
)
+
1
;
/* add "/$container_name/" */
len
+=
strlen
(
lxcpath
)
+
1
;
else
#endif
len
+=
strlen
(
lxcpath
)
+
1
;
p
=
malloc
(
len
);
p
=
malloc
(
len
);
if
(
!
p
)
if
(
!
p
)
return
p
;
return
p
;
#if USE_CONFIGPATH_LOGS
ret
=
snprintf
(
p
,
len
,
"%s/%s/%s.log"
,
lxcpath
,
name
,
name
);
if
(
use_dir
)
#else
ret
=
snprintf
(
p
,
len
,
"%s/%s/%s.log"
,
lxcpath
,
name
,
name
);
ret
=
snprintf
(
p
,
len
,
"%s/%s.log"
,
lxcpath
,
name
);
else
#endif
ret
=
snprintf
(
p
,
len
,
"%s/%s.log"
,
lxcpath
,
name
);
if
(
ret
<
0
||
ret
>=
len
)
{
if
(
ret
<
0
||
ret
>=
len
)
{
free
(
p
);
free
(
p
);
return
NULL
;
return
NULL
;
...
...
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