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
7b48c59d
Unverified
Commit
7b48c59d
authored
Aug 01, 2017
by
Christian Brauner
Committed by
Stéphane Graber
Aug 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: mount_autodev()
non-functional changes Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
af87624a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
conf.c
src/lxc/conf.c
+17
-19
No files found.
src/lxc/conf.c
View file @
7b48c59d
...
...
@@ -976,58 +976,56 @@ fail:
return
-
1
;
}
/*
* Just create a path for /dev under $lxcpath/$name and in rootfs
* If we hit an error, log it but don't fail yet.
/* Just create a path for /dev under $lxcpath/$name and in rootfs If we hit an
* error, log it but don't fail yet.
*/
static
int
mount_autodev
(
const
char
*
name
,
const
struct
lxc_rootfs
*
rootfs
,
const
char
*
lxcpath
)
static
int
mount_autodev
(
const
char
*
name
,
const
struct
lxc_rootfs
*
rootfs
,
const
char
*
lxcpath
)
{
int
ret
;
size_t
clen
;
char
*
path
;
INFO
(
"
Mounting container /dev
"
);
INFO
(
"
Preparing
\"
/dev
\"
"
);
/* $(rootfs->mount) + "/dev/pts" + '\0' */
clen
=
(
rootfs
->
path
?
strlen
(
rootfs
->
mount
)
:
0
)
+
9
;
path
=
alloca
(
clen
);
ret
=
snprintf
(
path
,
clen
,
"%s/dev"
,
rootfs
->
path
?
rootfs
->
mount
:
""
);
if
(
ret
<
0
||
ret
>=
clen
)
if
(
ret
<
0
||
(
size_t
)
ret
>=
clen
)
return
-
1
;
if
(
!
dir_exists
(
path
))
{
WARN
(
"
No /dev in container."
);
WARN
(
"Proceeding without autodev set
up"
);
WARN
(
"
\"
/dev
\"
directory does not exist. Proceeding without "
"autodev being set
up"
);
return
0
;
}
ret
=
safe_mount
(
"none"
,
path
,
"tmpfs"
,
0
,
"size=500000,mode=755"
,
rootfs
->
path
?
rootfs
->
mount
:
NULL
);
if
(
ret
!=
0
)
{
SYSERROR
(
"Failed
mounting tmpfs onto %s
\n
"
,
path
);
rootfs
->
path
?
rootfs
->
mount
:
NULL
);
if
(
ret
<
0
)
{
SYSERROR
(
"Failed
to mount tmpfs on
\"
%s
\"
"
,
path
);
return
-
1
;
}
INFO
(
"Mounted tmpfs onto %s"
,
path
);
INFO
(
"Mounted tmpfs on
\"
%s
\"
"
,
path
);
ret
=
snprintf
(
path
,
clen
,
"%s/dev/pts"
,
rootfs
->
path
?
rootfs
->
mount
:
""
);
if
(
ret
<
0
||
ret
>=
clen
)
if
(
ret
<
0
||
(
size_t
)
ret
>=
clen
)
return
-
1
;
/*
* If we are running on a devtmpfs mapping, dev/pts may already exist.
/* If we are running on a devtmpfs mapping, dev/pts may already exist.
* If not, then create it and exit if that fails...
*/
if
(
!
dir_exists
(
path
))
{
ret
=
mkdir
(
path
,
S_IRWXU
|
S_IRGRP
|
S_IXGRP
|
S_IROTH
|
S_IXOTH
);
if
(
ret
)
{
SYSERROR
(
"Failed to create
/dev/pts in container"
);
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to create
directory
\"
%s
\"
"
,
path
);
return
-
1
;
}
}
INFO
(
"
Mounted container /dev
"
);
INFO
(
"
Prepared
\"
/dev
\"
"
);
return
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