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
01149adf
Unverified
Commit
01149adf
authored
Feb 05, 2021
by
Stéphane Graber
Committed by
GitHub
Feb 05, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3660 from brauner/2021-02-05/fixes_1
mount_utils: initialize fd
parents
338c2abe
60218ee7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
29 deletions
+3
-29
attach.c
src/lxc/attach.c
+2
-2
mount_utils.c
src/lxc/mount_utils.c
+0
-24
mount_utils.h
src/lxc/mount_utils.h
+1
-3
No files found.
src/lxc/attach.c
View file @
01149adf
...
@@ -734,7 +734,7 @@ int lxc_attach_remount_sys_proc(void)
...
@@ -734,7 +734,7 @@ int lxc_attach_remount_sys_proc(void)
if
(
ret
<
0
)
if
(
ret
<
0
)
return
log_error_errno
(
-
1
,
errno
,
"Failed to unmount /proc"
);
return
log_error_errno
(
-
1
,
errno
,
"Failed to unmount /proc"
);
ret
=
mount
_filesystem
(
"proc"
,
"/proc"
,
0
);
ret
=
mount
(
"none"
,
"/proc"
,
"proc"
,
0
,
NULL
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
log_error_errno
(
-
1
,
errno
,
"Failed to remount /proc"
);
return
log_error_errno
(
-
1
,
errno
,
"Failed to remount /proc"
);
...
@@ -747,7 +747,7 @@ int lxc_attach_remount_sys_proc(void)
...
@@ -747,7 +747,7 @@ int lxc_attach_remount_sys_proc(void)
return
log_error_errno
(
-
1
,
errno
,
"Failed to unmount /sys"
);
return
log_error_errno
(
-
1
,
errno
,
"Failed to unmount /sys"
);
/* Remount it. */
/* Remount it. */
if
(
ret
==
0
&&
mount
_filesystem
(
"sysfs"
,
"/sys"
,
0
))
if
(
ret
==
0
&&
mount
(
"none"
,
"/sys"
,
"sysfs"
,
0
,
NULL
))
return
log_error_errno
(
-
1
,
errno
,
"Failed to remount /sys"
);
return
log_error_errno
(
-
1
,
errno
,
"Failed to remount /sys"
);
return
0
;
return
0
;
...
...
src/lxc/mount_utils.c
View file @
01149adf
...
@@ -116,30 +116,6 @@ int mnt_attributes_old(unsigned int new_flags, unsigned int *old_flags)
...
@@ -116,30 +116,6 @@ int mnt_attributes_old(unsigned int new_flags, unsigned int *old_flags)
return
new_flags
;
return
new_flags
;
}
}
int
mount_filesystem
(
const
char
*
fs_name
,
const
char
*
path
,
unsigned
int
attr_flags
)
{
__do_close
int
fsfd
=
-
EBADF
;
unsigned
int
old_flags
=
0
;
fsfd
=
fsopen
(
fs_name
,
FSOPEN_CLOEXEC
);
if
(
fsfd
>=
0
)
{
__do_close
int
mfd
=
-
EBADF
;
if
(
fsconfig
(
fsfd
,
FSCONFIG_CMD_CREATE
,
NULL
,
NULL
,
0
))
return
-
1
;
mfd
=
fsmount
(
fsfd
,
FSMOUNT_CLOEXEC
,
attr_flags
);
if
(
mfd
<
0
)
return
-
1
;
return
move_mount
(
mfd
,
""
,
AT_FDCWD
,
path
,
MOVE_MOUNT_F_EMPTY_PATH
);
}
TRACE
(
"Falling back to old mount api"
);
mnt_attributes_old
(
attr_flags
,
&
old_flags
);
return
mount
(
"none"
,
path
,
fs_name
,
old_flags
,
NULL
);
}
static
int
__fs_prepare
(
const
char
*
fs_name
,
int
fd_from
)
static
int
__fs_prepare
(
const
char
*
fs_name
,
int
fd_from
)
{
{
__do_close
int
fd_fs
=
-
EBADF
;
__do_close
int
fd_fs
=
-
EBADF
;
...
...
src/lxc/mount_utils.h
View file @
01149adf
...
@@ -156,8 +156,6 @@ __hidden extern int mnt_attributes_new(unsigned int old_flags, unsigned int *new
...
@@ -156,8 +156,6 @@ __hidden extern int mnt_attributes_new(unsigned int old_flags, unsigned int *new
__hidden
extern
int
mnt_attributes_old
(
unsigned
int
new_flags
,
unsigned
int
*
old_flags
);
__hidden
extern
int
mnt_attributes_old
(
unsigned
int
new_flags
,
unsigned
int
*
old_flags
);
__hidden
extern
int
mount_filesystem
(
const
char
*
fs_name
,
const
char
*
path
,
unsigned
int
attr_flags
);
__hidden
extern
int
fs_prepare
(
const
char
*
fs_name
,
int
dfd_from
,
__hidden
extern
int
fs_prepare
(
const
char
*
fs_name
,
int
dfd_from
,
const
char
*
path_from
,
__u64
o_flags_from
,
const
char
*
path_from
,
__u64
o_flags_from
,
__u64
resolve_flags_from
);
__u64
resolve_flags_from
);
...
@@ -195,7 +193,7 @@ __hidden extern int fd_bind_mount(int dfd_from, const char *path_from,
...
@@ -195,7 +193,7 @@ __hidden extern int fd_bind_mount(int dfd_from, const char *path_from,
*/
*/
static
inline
bool
new_mount_api
(
void
)
static
inline
bool
new_mount_api
(
void
)
{
{
__do_close
int
fd
;
__do_close
int
fd
=
-
EBADF
;
static
int
supported
=
-
1
;
static
int
supported
=
-
1
;
if
(
supported
==
-
1
)
{
if
(
supported
==
-
1
)
{
...
...
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