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
77d82ac6
Unverified
Commit
77d82ac6
authored
Dec 04, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attach: do not fail on non-existing namespaces
Closes #1993. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
5760a5a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
attach.c
src/lxc/attach.c
+8
-1
utils.c
src/lxc/utils.c
+2
-1
No files found.
src/lxc/attach.c
View file @
77d82ac6
...
@@ -281,8 +281,15 @@ static int in_same_namespace(pid_t pid1, pid_t pid2, const char *ns)
...
@@ -281,8 +281,15 @@ static int in_same_namespace(pid_t pid1, pid_t pid2, const char *ns)
struct
stat
ns_st1
,
ns_st2
;
struct
stat
ns_st1
,
ns_st2
;
ns_fd1
=
lxc_preserve_ns
(
pid1
,
ns
);
ns_fd1
=
lxc_preserve_ns
(
pid1
,
ns
);
if
(
ns_fd1
<
0
)
if
(
ns_fd1
<
0
)
{
/* The kernel does not support this namespace. This is not an
* error.
*/
if
(
errno
==
ENOENT
)
return
-
EINVAL
;
goto
out
;
goto
out
;
}
ns_fd2
=
lxc_preserve_ns
(
pid2
,
ns
);
ns_fd2
=
lxc_preserve_ns
(
pid2
,
ns
);
if
(
ns_fd2
<
0
)
if
(
ns_fd2
<
0
)
...
...
src/lxc/utils.c
View file @
77d82ac6
...
@@ -1967,8 +1967,9 @@ int lxc_preserve_ns(const int pid, const char *ns)
...
@@ -1967,8 +1967,9 @@ int lxc_preserve_ns(const int pid, const char *ns)
ret
=
snprintf
(
path
,
__NS_PATH_LEN
,
"/proc/%d/ns%s%s"
,
pid
,
ret
=
snprintf
(
path
,
__NS_PATH_LEN
,
"/proc/%d/ns%s%s"
,
pid
,
!
ns
||
strcmp
(
ns
,
""
)
==
0
?
""
:
"/"
,
!
ns
||
strcmp
(
ns
,
""
)
==
0
?
""
:
"/"
,
!
ns
||
strcmp
(
ns
,
""
)
==
0
?
""
:
ns
);
!
ns
||
strcmp
(
ns
,
""
)
==
0
?
""
:
ns
);
errno
=
EFBIG
;
if
(
ret
<
0
||
(
size_t
)
ret
>=
__NS_PATH_LEN
)
if
(
ret
<
0
||
(
size_t
)
ret
>=
__NS_PATH_LEN
)
return
-
1
;
return
-
EFBIG
;
return
open
(
path
,
O_RDONLY
|
O_CLOEXEC
);
return
open
(
path
,
O_RDONLY
|
O_CLOEXEC
);
}
}
...
...
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