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
73363c61
Unverified
Commit
73363c61
authored
Sep 05, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: non-functional changes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
8a0c5033
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
conf.c
src/lxc/conf.c
+11
-17
No files found.
src/lxc/conf.c
View file @
73363c61
...
...
@@ -854,23 +854,19 @@ static int lxc_setup_tty(struct lxc_conf *conf)
struct
lxc_pty_info
*
pty_info
=
&
tty_info
->
pty_info
[
i
];
ret
=
snprintf
(
path
,
sizeof
(
path
),
"/dev/tty%d"
,
i
+
1
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
path
))
{
ERROR
(
"pathname too long for ttys"
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
path
))
return
-
1
;
}
if
(
ttydir
)
{
/* create dev/lxc/tty%d" */
ret
=
snprintf
(
lxcpath
,
sizeof
(
lxcpath
),
"/dev/%s/tty%d"
,
ttydir
,
i
+
1
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
lxcpath
))
{
ERROR
(
"pathname too long for ttys"
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
lxcpath
))
return
-
1
;
}
ret
=
creat
(
lxcpath
,
0660
);
if
(
ret
<
0
&&
errno
!=
EEXIST
)
{
SYSERROR
(
"
f
ailed to create
\"
%s
\"
"
,
lxcpath
);
SYSERROR
(
"
F
ailed to create
\"
%s
\"
"
,
lxcpath
);
return
-
1
;
}
if
(
ret
>=
0
)
...
...
@@ -878,13 +874,13 @@ static int lxc_setup_tty(struct lxc_conf *conf)
ret
=
unlink
(
path
);
if
(
ret
<
0
&&
errno
!=
ENOENT
)
{
SYSERROR
(
"
f
ailed to unlink
\"
%s
\"
"
,
path
);
SYSERROR
(
"
F
ailed to unlink
\"
%s
\"
"
,
path
);
return
-
1
;
}
ret
=
mount
(
pty_info
->
name
,
lxcpath
,
"none"
,
MS_BIND
,
0
);
if
(
ret
<
0
)
{
WARN
(
"
f
ailed to bind mount
\"
%s
\"
onto
\"
%s
\"
"
,
WARN
(
"
F
ailed to bind mount
\"
%s
\"
onto
\"
%s
\"
"
,
pty_info
->
name
,
path
);
continue
;
}
...
...
@@ -893,14 +889,12 @@ static int lxc_setup_tty(struct lxc_conf *conf)
ret
=
snprintf
(
lxcpath
,
sizeof
(
lxcpath
),
"%s/tty%d"
,
ttydir
,
i
+
1
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
lxcpath
))
{
ERROR
(
"tty pathname too long"
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
lxcpath
))
return
-
1
;
}
ret
=
symlink
(
lxcpath
,
path
);
if
(
ret
<
0
)
{
SYSERROR
(
"
f
ailed to create symlink
\"
%s
\"
->
\"
%s
\"
"
,
SYSERROR
(
"
F
ailed to create symlink
\"
%s
\"
->
\"
%s
\"
"
,
path
,
lxcpath
);
return
-
1
;
}
...
...
@@ -912,7 +906,7 @@ static int lxc_setup_tty(struct lxc_conf *conf)
if
(
ret
<
0
)
{
ret
=
creat
(
path
,
0660
);
if
(
ret
<
0
)
{
SYSERROR
(
"
f
ailed to create
\"
%s
\"
"
,
path
);
SYSERROR
(
"
F
ailed to create
\"
%s
\"
"
,
path
);
/* this isn't fatal, continue */
}
else
{
close
(
ret
);
...
...
@@ -921,11 +915,11 @@ static int lxc_setup_tty(struct lxc_conf *conf)
ret
=
mount
(
pty_info
->
name
,
path
,
"none"
,
MS_BIND
,
0
);
if
(
ret
<
0
)
{
SYSERROR
(
"
f
ailed to mount '%s'->'%s'"
,
pty_info
->
name
,
path
);
SYSERROR
(
"
F
ailed to mount '%s'->'%s'"
,
pty_info
->
name
,
path
);
continue
;
}
DEBUG
(
"
b
ind mounted
\"
%s
\"
onto
\"
%s
\"
"
,
pty_info
->
name
,
DEBUG
(
"
B
ind mounted
\"
%s
\"
onto
\"
%s
\"
"
,
pty_info
->
name
,
path
);
}
...
...
@@ -935,7 +929,7 @@ static int lxc_setup_tty(struct lxc_conf *conf)
}
}
INFO
(
"
f
inished setting up %d /dev/tty<N> device(s)"
,
tty_info
->
nbtty
);
INFO
(
"
F
inished setting up %d /dev/tty<N> device(s)"
,
tty_info
->
nbtty
);
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