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
e54ecee4
Commit
e54ecee4
authored
Nov 28, 2017
by
AustinReichert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/lxc_start: removed internal logging
Signed-off-by:
AustinReichert
<
austinskyreichert@utexas.edu
>
parent
8a0a156e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
lxc_start.c
src/lxc/tools/lxc_start.c
+14
-17
No files found.
src/lxc/tools/lxc_start.c
View file @
e54ecee4
...
...
@@ -55,8 +55,6 @@
#define OPT_SHARE_UTS OPT_USAGE + 3
#define OPT_SHARE_PID OPT_USAGE + 4
lxc_log_define
(
lxc_start_ui
,
lxc
);
static
struct
lxc_list
defines
;
static
int
ensure_path
(
char
**
confpath
,
const
char
*
path
)
...
...
@@ -68,7 +66,7 @@ static int ensure_path(char **confpath, const char *path)
if
(
access
(
path
,
W_OK
))
{
fd
=
creat
(
path
,
0600
);
if
(
fd
<
0
&&
errno
!=
EEXIST
)
{
SYSERROR
(
"failed to create '%s'
"
,
path
);
fprintf
(
stderr
,
"failed to create '%s'
\n
"
,
path
);
goto
err
;
}
if
(
fd
>=
0
)
...
...
@@ -77,7 +75,7 @@ static int ensure_path(char **confpath, const char *path)
fullpath
=
realpath
(
path
,
NULL
);
if
(
!
fullpath
)
{
SYSERROR
(
"failed to get the real path of '%s'
"
,
path
);
fprintf
(
stderr
,
"failed to get the real path of '%s'
\n
"
,
path
);
goto
err
;
}
...
...
@@ -212,18 +210,18 @@ int main(int argc, char *argv[])
rcfile
=
(
char
*
)
my_args
.
rcfile
;
c
=
lxc_container_new
(
my_args
.
name
,
lxcpath
);
if
(
!
c
)
{
ERROR
(
"Failed to create lxc_container
"
);
fprintf
(
stderr
,
"Failed to create lxc_container
\n
"
);
exit
(
err
);
}
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
rcfile
))
{
ERROR
(
"Failed to load rcfile
"
);
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
lxc_container_put
(
c
);
exit
(
err
);
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
ERROR
(
"Out of memory setting new config filename
"
);
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
goto
out
;
}
}
else
{
...
...
@@ -231,10 +229,9 @@ int main(int argc, char *argv[])
rc
=
asprintf
(
&
rcfile
,
"%s/%s/config"
,
lxcpath
,
my_args
.
name
);
if
(
rc
==
-
1
)
{
SYSERROR
(
"failed to allocate memory
"
);
fprintf
(
stderr
,
"failed to allocate memory
\n
"
);
exit
(
err
);
}
INFO
(
"using rcfile %s"
,
rcfile
);
/* container configuration does not exist */
if
(
access
(
rcfile
,
F_OK
))
{
...
...
@@ -243,7 +240,7 @@ int main(int argc, char *argv[])
}
c
=
lxc_container_new
(
my_args
.
name
,
lxcpath
);
if
(
!
c
)
{
ERROR
(
"Failed to create lxc_container
"
);
fprintf
(
stderr
,
"Failed to create lxc_container
\n
"
);
exit
(
err
);
}
}
...
...
@@ -260,7 +257,7 @@ int main(int argc, char *argv[])
}
if
(
c
->
is_running
(
c
))
{
ERROR
(
"Container is already running.
"
);
fprintf
(
stderr
,
"Container is already running.
\n
"
);
err
=
EXIT_SUCCESS
;
goto
out
;
}
...
...
@@ -276,13 +273,13 @@ int main(int argc, char *argv[])
goto
out
;
if
(
!
rcfile
&&
!
strcmp
(
"/sbin/init"
,
args
[
0
]))
{
ERROR
(
"Executing '/sbin/init' with no configuration file may crash the host
"
);
fprintf
(
stderr
,
"Executing '/sbin/init' with no configuration file may crash the host
\n
"
);
goto
out
;
}
if
(
my_args
.
pidfile
!=
NULL
)
{
if
(
ensure_path
(
&
c
->
pidfile
,
my_args
.
pidfile
)
<
0
)
{
ERROR
(
"failed to ensure pidfile '%s'
"
,
my_args
.
pidfile
);
fprintf
(
stderr
,
"failed to ensure pidfile '%s'
\n
"
,
my_args
.
pidfile
);
goto
out
;
}
}
...
...
@@ -322,11 +319,11 @@ int main(int argc, char *argv[])
err
=
c
->
start
(
c
,
0
,
args
)
?
EXIT_SUCCESS
:
EXIT_FAILURE
;
if
(
err
)
{
ERROR
(
"The container failed to start.
"
);
fprintf
(
stderr
,
"The container failed to start.
\n
"
);
if
(
my_args
.
daemonize
)
ERROR
(
"To get more details, run the container in foreground mode.
"
);
ERROR
(
"Additional information can be obtained by setting the "
"--logfile and --logpriority options."
);
fprintf
(
stderr
,
"To get more details, run the container in foreground mode.
\n
"
);
fprintf
(
stderr
,
"Additional information can be obtained by setting the "
"--logfile and --logpriority options.
\n
"
);
err
=
c
->
error_num
;
lxc_container_put
(
c
);
exit
(
err
);
...
...
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