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
c3b3643a
Unverified
Commit
c3b3643a
authored
Nov 10, 2017
by
Christian Brauner
Committed by
GitHub
Nov 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1913 from AustinReichert/remove-api-calls
First tools/ refactor for review
parents
d4624e94
f0ccfa13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
lxc_attach.c
src/lxc/tools/lxc_attach.c
+8
-12
No files found.
src/lxc/tools/lxc_attach.c
View file @
c3b3643a
...
@@ -52,8 +52,6 @@
...
@@ -52,8 +52,6 @@
#include <../include/openpty.h>
#include <../include/openpty.h>
#endif
#endif
lxc_log_define
(
lxc_attach_ui
,
lxc
);
static
const
struct
option
my_longopts
[]
=
{
static
const
struct
option
my_longopts
[]
=
{
{
"elevated-privileges"
,
optional_argument
,
0
,
'e'
},
{
"elevated-privileges"
,
optional_argument
,
0
,
'e'
},
{
"arch"
,
required_argument
,
0
,
'a'
},
{
"arch"
,
required_argument
,
0
,
'a'
},
...
@@ -286,10 +284,8 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
...
@@ -286,10 +284,8 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
int
ret
=
-
1
;
int
ret
=
-
1
;
struct
wrapargs
*
args
=
wrap
;
struct
wrapargs
*
args
=
wrap
;
INFO
(
"Trying to allocate a pty on the host"
);
if
(
!
isatty
(
args
->
ptyfd
))
{
if
(
!
isatty
(
args
->
ptyfd
))
{
ERROR
(
"Standard file descriptor does not refer to a pty
"
);
fprintf
(
stderr
,
"Standard file descriptor does not refer to a pty
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -301,7 +297,7 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
...
@@ -301,7 +297,7 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
*/
*/
conf
=
lxc_conf_init
();
conf
=
lxc_conf_init
();
if
(
!
conf
)
{
if
(
!
conf
)
{
ERROR
(
"Failed to allocate dummy config file for the container
"
);
fprintf
(
stderr
,
"Failed to allocate dummy config file for the container
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -343,7 +339,7 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
...
@@ -343,7 +339,7 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
/* Shift ttys to container. */
/* Shift ttys to container. */
if
(
lxc_ttys_shift_ids
(
conf
)
<
0
)
{
if
(
lxc_ttys_shift_ids
(
conf
)
<
0
)
{
ERROR
(
"Failed to shift tty into container
"
);
fprintf
(
stderr
,
"Failed to shift tty into container
\n
"
);
goto
err1
;
goto
err1
;
}
}
...
@@ -355,18 +351,18 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
...
@@ -355,18 +351,18 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
ret
=
lxc_mainloop_open
(
&
descr
);
ret
=
lxc_mainloop_open
(
&
descr
);
if
(
ret
)
{
if
(
ret
)
{
ERROR
(
"failed to create mainloop
"
);
fprintf
(
stderr
,
"failed to create mainloop
\n
"
);
goto
err2
;
goto
err2
;
}
}
if
(
lxc_console_mainloop_add
(
&
descr
,
conf
)
<
0
)
{
if
(
lxc_console_mainloop_add
(
&
descr
,
conf
)
<
0
)
{
ERROR
(
"Failed to add handlers to lxc mainloop.
"
);
fprintf
(
stderr
,
"Failed to add handlers to lxc mainloop.
\n
"
);
goto
err3
;
goto
err3
;
}
}
ret
=
lxc_mainloop
(
&
descr
,
-
1
);
ret
=
lxc_mainloop
(
&
descr
,
-
1
);
if
(
ret
)
{
if
(
ret
)
{
ERROR
(
"mainloop returned an error
"
);
fprintf
(
stderr
,
"mainloop returned an error
\n
"
);
goto
err3
;
goto
err3
;
}
}
ret
=
0
;
ret
=
0
;
...
@@ -443,13 +439,13 @@ int main(int argc, char *argv[])
...
@@ -443,13 +439,13 @@ int main(int argc, char *argv[])
if
(
my_args
.
rcfile
)
{
if
(
my_args
.
rcfile
)
{
c
->
clear_config
(
c
);
c
->
clear_config
(
c
);
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
if
(
!
c
->
load_config
(
c
,
my_args
.
rcfile
))
{
ERROR
(
"Failed to load rcfile
"
);
fprintf
(
stderr
,
"Failed to load rcfile
\n
"
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
c
->
configfile
=
strdup
(
my_args
.
rcfile
);
if
(
!
c
->
configfile
)
{
if
(
!
c
->
configfile
)
{
ERROR
(
"Out of memory setting new config filename
"
);
fprintf
(
stderr
,
"Out of memory setting new config filename
\n
"
);
lxc_container_put
(
c
);
lxc_container_put
(
c
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
...
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