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
c2af3a15
Unverified
Commit
c2af3a15
authored
Mar 09, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attach: cleanup various helpers
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
02d3b72b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
18 deletions
+9
-18
attach.c
src/lxc/attach.c
+9
-18
No files found.
src/lxc/attach.c
View file @
c2af3a15
...
@@ -894,10 +894,8 @@ static int lxc_attach_terminal(struct lxc_conf *conf,
...
@@ -894,10 +894,8 @@ static int lxc_attach_terminal(struct lxc_conf *conf,
lxc_terminal_init
(
terminal
);
lxc_terminal_init
(
terminal
);
ret
=
lxc_terminal_create
(
terminal
);
ret
=
lxc_terminal_create
(
terminal
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
ERROR
(
"Failed to create terminal"
);
return
log_error
(
-
1
,
"Failed to create terminal"
);
return
-
1
;
}
/* Shift ttys to container. */
/* Shift ttys to container. */
ret
=
lxc_terminal_map_ids
(
conf
,
terminal
);
ret
=
lxc_terminal_map_ids
(
conf
,
terminal
);
...
@@ -920,16 +918,13 @@ static int lxc_attach_terminal_mainloop_init(struct lxc_terminal *terminal,
...
@@ -920,16 +918,13 @@ static int lxc_attach_terminal_mainloop_init(struct lxc_terminal *terminal,
int
ret
;
int
ret
;
ret
=
lxc_mainloop_open
(
descr
);
ret
=
lxc_mainloop_open
(
descr
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
ERROR
(
"Failed to create mainloop"
);
return
log_error
(
-
1
,
"Failed to create mainloop"
);
return
-
1
;
}
ret
=
lxc_terminal_mainloop_add
(
descr
,
terminal
);
ret
=
lxc_terminal_mainloop_add
(
descr
,
terminal
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed to add handlers to mainloop"
);
lxc_mainloop_close
(
descr
);
lxc_mainloop_close
(
descr
);
return
-
1
;
return
log_error
(
-
1
,
"Failed to add handlers to mainloop"
)
;
}
}
return
0
;
return
0
;
...
@@ -971,10 +966,8 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
...
@@ -971,10 +966,8 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
struct
attach_clone_payload
payload
=
{
0
};
struct
attach_clone_payload
payload
=
{
0
};
ret
=
access
(
"/proc/self/ns"
,
X_OK
);
ret
=
access
(
"/proc/self/ns"
,
X_OK
);
if
(
ret
)
{
if
(
ret
)
SYSERROR
(
"Does this kernel version support namespaces?"
);
return
log_error_errno
(
-
1
,
errno
,
"Does this kernel version support namespaces?"
);
return
-
1
;
}
if
(
!
container
)
if
(
!
container
)
return
ret_set_errno
(
-
1
,
EINVAL
);
return
ret_set_errno
(
-
1
,
EINVAL
);
...
@@ -990,9 +983,8 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
...
@@ -990,9 +983,8 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
init_pid
=
lxc_cmd_get_init_pid
(
name
,
lxcpath
);
init_pid
=
lxc_cmd_get_init_pid
(
name
,
lxcpath
);
if
(
init_pid
<
0
)
{
if
(
init_pid
<
0
)
{
ERROR
(
"Failed to get init pid"
);
lxc_container_put
(
container
);
lxc_container_put
(
container
);
return
-
1
;
return
log_error
(
-
1
,
"Failed to get init pid"
)
;
}
}
init_ctx
=
lxc_proc_get_context_info
(
init_pid
);
init_ctx
=
lxc_proc_get_context_info
(
init_pid
);
...
@@ -1452,8 +1444,7 @@ int lxc_attach_run_command(void *payload)
...
@@ -1452,8 +1444,7 @@ int lxc_attach_run_command(void *payload)
}
}
}
}
SYSERROR
(
"Failed to exec
\"
%s
\"
"
,
cmd
->
program
);
return
log_error_errno
(
ret
,
errno
,
"Failed to exec
\"
%s
\"
"
,
cmd
->
program
);
return
ret
;
}
}
int
lxc_attach_run_shell
(
void
*
payload
)
int
lxc_attach_run_shell
(
void
*
payload
)
...
...
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