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
aaf901be
Commit
aaf901be
authored
Dec 24, 2013
by
Andrey Mazo
Committed by
Serge Hallyn
Dec 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use getmntent_r() for thread-safety
Signed-off-by:
Andrey Mazo
<
mazo@telum.ru
>
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
dd1d77f9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
conf.c
src/lxc/conf.c
+10
-9
No files found.
src/lxc/conf.c
View file @
aaf901be
...
@@ -1859,7 +1859,7 @@ static int mount_entry(const char *fsname, const char *target,
...
@@ -1859,7 +1859,7 @@ static int mount_entry(const char *fsname, const char *target,
return
0
;
return
0
;
}
}
static
inline
int
mount_entry_on_systemfs
(
struct
mntent
*
mntent
)
static
inline
int
mount_entry_on_systemfs
(
const
struct
mntent
*
mntent
)
{
{
unsigned
long
mntflags
;
unsigned
long
mntflags
;
char
*
mntdata
;
char
*
mntdata
;
...
@@ -1904,7 +1904,7 @@ static inline int mount_entry_on_systemfs(struct mntent *mntent)
...
@@ -1904,7 +1904,7 @@ static inline int mount_entry_on_systemfs(struct mntent *mntent)
return
ret
;
return
ret
;
}
}
static
int
mount_entry_on_absolute_rootfs
(
struct
mntent
*
mntent
,
static
int
mount_entry_on_absolute_rootfs
(
const
struct
mntent
*
mntent
,
const
struct
lxc_rootfs
*
rootfs
,
const
struct
lxc_rootfs
*
rootfs
,
const
char
*
lxc_name
)
const
char
*
lxc_name
)
{
{
...
@@ -1990,7 +1990,7 @@ out:
...
@@ -1990,7 +1990,7 @@ out:
return
ret
;
return
ret
;
}
}
static
int
mount_entry_on_relative_rootfs
(
struct
mntent
*
mntent
,
static
int
mount_entry_on_relative_rootfs
(
const
struct
mntent
*
mntent
,
const
char
*
rootfs
)
const
char
*
rootfs
)
{
{
char
path
[
MAXPATHLEN
];
char
path
[
MAXPATHLEN
];
...
@@ -2047,26 +2047,27 @@ static int mount_entry_on_relative_rootfs(struct mntent *mntent,
...
@@ -2047,26 +2047,27 @@ static int mount_entry_on_relative_rootfs(struct mntent *mntent,
static
int
mount_file_entries
(
const
struct
lxc_rootfs
*
rootfs
,
FILE
*
file
,
static
int
mount_file_entries
(
const
struct
lxc_rootfs
*
rootfs
,
FILE
*
file
,
const
char
*
lxc_name
)
const
char
*
lxc_name
)
{
{
struct
mntent
*
mntent
;
struct
mntent
mntent
;
char
buf
[
4096
];
int
ret
=
-
1
;
int
ret
=
-
1
;
while
(
(
mntent
=
getmntent
(
file
)))
{
while
(
getmntent_r
(
file
,
&
mntent
,
buf
,
sizeof
(
buf
)))
{
if
(
!
rootfs
->
path
)
{
if
(
!
rootfs
->
path
)
{
if
(
mount_entry_on_systemfs
(
mntent
))
if
(
mount_entry_on_systemfs
(
&
mntent
))
goto
out
;
goto
out
;
continue
;
continue
;
}
}
/* We have a separate root, mounts are relative to it */
/* We have a separate root, mounts are relative to it */
if
(
mntent
->
mnt_dir
[
0
]
!=
'/'
)
{
if
(
mntent
.
mnt_dir
[
0
]
!=
'/'
)
{
if
(
mount_entry_on_relative_rootfs
(
mntent
,
if
(
mount_entry_on_relative_rootfs
(
&
mntent
,
rootfs
->
mount
))
rootfs
->
mount
))
goto
out
;
goto
out
;
continue
;
continue
;
}
}
if
(
mount_entry_on_absolute_rootfs
(
mntent
,
rootfs
,
lxc_name
))
if
(
mount_entry_on_absolute_rootfs
(
&
mntent
,
rootfs
,
lxc_name
))
goto
out
;
goto
out
;
}
}
...
...
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