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
1b36d9e9
Unverified
Commit
1b36d9e9
authored
Jun 28, 2018
by
2xsec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: lxc-attach: share internal API symbols
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
93f81bc7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
10 deletions
+17
-10
Makefile.am
src/lxc/Makefile.am
+1
-1
lxc_attach.c
src/lxc/tools/lxc_attach.c
+16
-9
No files found.
src/lxc/Makefile.am
View file @
1b36d9e9
...
...
@@ -265,7 +265,7 @@ endif
LDADD
=
liblxc.la @CAP_LIBS@ @GNUTLS_LIBS@ @SELINUX_LIBS@ @SECCOMP_LIBS@
if
ENABLE_TOOLS
lxc_attach_SOURCES
=
tools/lxc_attach.c tools/arguments.c
tools/tool_utils.c
lxc_attach_SOURCES
=
tools/lxc_attach.c tools/arguments.c
lxc_autostart_SOURCES
=
tools/lxc_autostart.c tools/arguments.c tools/tool_utils.c
lxc_cgroup_SOURCES
=
tools/lxc_cgroup.c tools/arguments.c
lxc_config_SOURCES
=
tools/lxc_config.c tools/arguments.c tools/tool_utils.c
...
...
src/lxc/tools/lxc_attach.c
View file @
1b36d9e9
...
...
@@ -37,7 +37,13 @@
#include <lxc/lxccontainer.h>
#include "arguments.h"
#include "tool_utils.h"
#include "attach.h"
#include "caps.h"
#include "confile.h"
#include "log.h"
#include "utils.h"
lxc_log_define
(
lxc_attach
,
lxc
);
static
const
struct
option
my_longopts
[]
=
{
{
"elevated-privileges"
,
optional_argument
,
0
,
'e'
},
...
...
@@ -108,7 +114,7 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
case
'a'
:
new_personality
=
lxc_config_parse_arch
(
arg
);
if
(
new_personality
<
0
)
{
lxc_error
(
args
,
"i
nvalid architecture specified: %s"
,
arg
);
ERROR
(
"I
nvalid architecture specified: %s"
,
arg
);
return
-
1
;
}
break
;
...
...
@@ -153,14 +159,14 @@ static int my_parser(struct lxc_arguments *args, int c, char *arg)
case
502
:
/* keep-var */
ret
=
add_to_simple_array
(
&
extra_keep
,
&
extra_keep_size
,
arg
);
if
(
ret
<
0
)
{
lxc_error
(
args
,
"memory allocation error
"
);
ERROR
(
"Failed to alloc memory
"
);
return
-
1
;
}
break
;
case
'v'
:
ret
=
add_to_simple_array
(
&
extra_env
,
&
extra_env_size
,
arg
);
if
(
ret
<
0
)
{
lxc_error
(
args
,
"memory allocation error
"
);
ERROR
(
"Failed to alloc memory
"
);
return
-
1
;
}
break
;
...
...
@@ -246,7 +252,7 @@ static int lxc_attach_create_log_file(const char *log_file)
fd
=
open
(
log_file
,
O_CLOEXEC
|
O_RDWR
|
O_CREAT
|
O_APPEND
,
0600
);
if
(
fd
<
0
)
{
lxc_error
(
&
my_args
,
"Failed to open log file
\"
%s
\"
"
,
log_file
);
ERROR
(
"Failed to open log file
\"
%s
\"
"
,
log_file
);
return
-
1
;
}
...
...
@@ -285,7 +291,7 @@ int main(int argc, char *argv[])
if
(
geteuid
())
{
if
(
access
(
my_args
.
lxcpath
[
0
],
O_RDONLY
)
<
0
)
{
lxc_error
(
&
my_args
,
"You lack access to %s"
,
my_args
.
lxcpath
[
0
]);
ERROR
(
"You lack access to %s"
,
my_args
.
lxcpath
[
0
]);
exit
(
EXIT_FAILURE
);
}
}
...
...
@@ -297,21 +303,21 @@ int main(int argc, char *argv[])
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
lxc_error
(
&
my_args
,
"Failed to load rcfile"
);
ERROR
(
"Failed to load rcfile"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
lxc_error
(
&
my_args
,
"Out of memory setting new config filename"
);
ERROR
(
"Out of memory setting new config filename"
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
}
if
(
!
c
->
may_control
(
c
))
{
lxc_error
(
&
my_args
,
"Insufficent privileges to control %s"
,
c
->
name
);
ERROR
(
"Insufficent privileges to control %s"
,
c
->
name
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -355,6 +361,7 @@ int main(int argc, char *argv[])
if
(
WIFEXITED
(
ret
))
wexit
=
WEXITSTATUS
(
ret
);
out:
lxc_container_put
(
c
);
if
(
ret
>=
0
)
...
...
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