Skip to content

Commit

Permalink
namespaces: nsenter: ignore nonexistent namespaces
Browse files Browse the repository at this point in the history
If a particular kernel doesn't have namespace directories that
libcontainer tries to attain during nsenter(), ignore the error (this is
consistent with the previous implementation of nsenter()).

Docker-DCO-1.1-Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
  • Loading branch information
cyphar authored and maebashi committed Jul 28, 2014
1 parent 16f939a commit 01a7f19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions namespaces/nsenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ void nsenter() {
snprintf(buf, PATH_MAX - 1, "%s%s", ns_dir, namespaces[i]);
int fd = open(buf, O_RDONLY);
if (fd == -1) {
// Ignore nonexistent namespaces.
if (errno == ENOENT)
continue;
fprintf(stderr, "nsenter: Failed to open ns file \"%s\" for ns \"%s\" with error: \"%s\"\n", buf, namespaces[i], strerror(errno));
exit(1);
}
Expand Down

0 comments on commit 01a7f19

Please sign in to comment.