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
b4e90f9f
Unverified
Commit
b4e90f9f
authored
Feb 08, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: kill PATH_MAX bytes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
eefaa69c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
conf.c
src/lxc/conf.c
+12
-13
No files found.
src/lxc/conf.c
View file @
b4e90f9f
...
@@ -1642,12 +1642,11 @@ static inline bool wants_console(const struct lxc_terminal *terminal)
...
@@ -1642,12 +1642,11 @@ static inline bool wants_console(const struct lxc_terminal *terminal)
return
!
terminal
->
path
||
strcmp
(
terminal
->
path
,
"none"
);
return
!
terminal
->
path
||
strcmp
(
terminal
->
path
,
"none"
);
}
}
static
int
lxc_setup_dev_console
(
const
struct
lxc_rootfs
*
rootfs
,
static
int
lxc_setup_dev_console
(
struct
lxc_rootfs
*
rootfs
,
const
struct
lxc_terminal
*
console
,
const
struct
lxc_terminal
*
console
,
int
pty_mnt_fd
)
int
pty_mnt_fd
)
{
{
int
ret
;
int
ret
;
char
path
[
PATH_MAX
];
char
*
rootfs_path
=
rootfs
->
path
?
rootfs
->
mount
:
""
;
char
*
rootfs_path
=
rootfs
->
path
?
rootfs
->
mount
:
""
;
if
(
!
wants_console
(
console
))
if
(
!
wants_console
(
console
))
...
@@ -1658,15 +1657,15 @@ static int lxc_setup_dev_console(const struct lxc_rootfs *rootfs,
...
@@ -1658,15 +1657,15 @@ static int lxc_setup_dev_console(const struct lxc_rootfs *rootfs,
* /dev/console bind-mounts.
* /dev/console bind-mounts.
*/
*/
if
(
exists_file_at
(
rootfs
->
dfd_dev
,
"console"
))
{
if
(
exists_file_at
(
rootfs
->
dfd_dev
,
"console"
))
{
ret
=
snprintf
(
path
,
sizeof
(
path
),
"%s/dev/console"
,
rootfs_path
);
ret
=
snprintf
(
rootfs
->
buf
,
sizeof
(
rootfs
->
buf
),
"%s/dev/console"
,
rootfs_path
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
path
))
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
rootfs
->
buf
))
return
-
1
;
return
-
1
;
ret
=
lxc_unstack_mountpoint
(
path
,
false
);
ret
=
lxc_unstack_mountpoint
(
rootfs
->
buf
,
false
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
log_error_errno
(
-
ret
,
errno
,
"Failed to unmount
\"
%s
\"
"
,
path
);
return
log_error_errno
(
-
ret
,
errno
,
"Failed to unmount
\"
%s
\"
"
,
rootfs
->
buf
);
else
else
DEBUG
(
"Cleared all (%d) mounts from
\"
%s
\"
"
,
ret
,
path
);
DEBUG
(
"Cleared all (%d) mounts from
\"
%s
\"
"
,
ret
,
rootfs
->
buf
);
}
}
/*
/*
...
@@ -1697,17 +1696,17 @@ static int lxc_setup_dev_console(const struct lxc_rootfs *rootfs,
...
@@ -1697,17 +1696,17 @@ static int lxc_setup_dev_console(const struct lxc_rootfs *rootfs,
ret
=
safe_mount_beneath_at
(
rootfs
->
dfd_dev
,
console
->
name
,
"console"
,
NULL
,
MS_BIND
,
NULL
);
ret
=
safe_mount_beneath_at
(
rootfs
->
dfd_dev
,
console
->
name
,
"console"
,
NULL
,
MS_BIND
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
if
(
errno
==
ENOSYS
)
{
if
(
errno
==
ENOSYS
)
{
ret
=
snprintf
(
path
,
sizeof
(
path
),
"%s/dev/console"
,
rootfs_path
);
ret
=
snprintf
(
rootfs
->
buf
,
sizeof
(
rootfs
->
buf
),
"%s/dev/console"
,
rootfs_path
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
path
))
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
rootfs
->
buf
))
return
-
1
;
return
-
1
;
ret
=
safe_mount
(
console
->
name
,
path
,
"none"
,
MS_BIND
,
NULL
,
rootfs_path
);
ret
=
safe_mount
(
console
->
name
,
rootfs
->
buf
,
"none"
,
MS_BIND
,
NULL
,
rootfs_path
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
log_error_errno
(
-
1
,
errno
,
"Failed to mount %d(%s) on
\"
%s
\"
"
,
pty_mnt_fd
,
console
->
name
,
path
);
return
log_error_errno
(
-
1
,
errno
,
"Failed to mount %d(%s) on
\"
%s
\"
"
,
pty_mnt_fd
,
console
->
name
,
rootfs
->
buf
);
}
}
}
}
DEBUG
(
"Mounted pty device %d(%s) onto
\"
%s
\"
"
,
pty_mnt_fd
,
console
->
name
,
path
);
DEBUG
(
"Mounted pty device %d(%s) onto
\"
%s
\"
"
,
pty_mnt_fd
,
console
->
name
,
rootfs
->
buf
);
return
0
;
return
0
;
}
}
...
@@ -1790,7 +1789,7 @@ finish:
...
@@ -1790,7 +1789,7 @@ finish:
return
0
;
return
0
;
}
}
static
int
lxc_setup_console
(
const
struct
lxc_rootfs
*
rootfs
,
static
int
lxc_setup_console
(
struct
lxc_rootfs
*
rootfs
,
const
struct
lxc_terminal
*
console
,
char
*
ttydir
,
const
struct
lxc_terminal
*
console
,
char
*
ttydir
,
int
pty_mnt_fd
)
int
pty_mnt_fd
)
{
{
...
...
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