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
5e4a62bf
Commit
5e4a62bf
authored
Oct 09, 2009
by
Daniel Lezcano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tty creation using confdir
tty_create uses the old conf directory, fixing this. Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
5f4535a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
42 deletions
+7
-42
conf.c
src/lxc/conf.c
+5
-40
conf.h
src/lxc/conf.h
+1
-1
start.c
src/lxc/start.c
+1
-1
No files found.
src/lxc/conf.c
View file @
5e4a62bf
...
...
@@ -107,32 +107,6 @@ static struct mount_opt mount_opt[] = {
{
NULL
,
0
,
0
},
};
static
int
read_info
(
const
char
*
path
,
const
char
*
file
,
char
*
info
,
size_t
len
)
{
int
fd
,
ret
=
-
1
;
char
f
[
MAXPATHLEN
],
*
token
;
snprintf
(
f
,
MAXPATHLEN
,
"%s/%s"
,
path
,
file
);
fd
=
open
(
f
,
O_RDONLY
);
if
(
fd
<
0
)
{
if
(
errno
==
ENOENT
)
ret
=
1
;
goto
out
;
}
ret
=
read
(
fd
,
info
,
len
);
if
(
ret
<
0
)
goto
out
;
token
=
strstr
(
info
,
"
\n
"
);
if
(
token
)
*
token
=
'\0'
;
ret
=
0
;
out:
close
(
fd
);
return
ret
;
}
static
int
delete_info
(
const
char
*
path
,
const
char
*
file
)
{
char
info
[
MAXPATHLEN
];
...
...
@@ -1152,25 +1126,16 @@ int lxc_assign_network(struct lxc_list *network, pid_t pid)
return
0
;
}
int
lxc_create_tty
(
const
char
*
name
,
struct
lxc_
tty_info
*
tty_info
)
int
lxc_create_tty
(
const
char
*
name
,
struct
lxc_
conf
*
conf
)
{
char
path
[
MAXPATHLEN
];
char
tty
[
4
];
struct
lxc_tty_info
*
tty_info
=
&
conf
->
tty_info
;
int
i
,
ret
=
-
1
;
tty_info
->
nbtty
=
0
;
if
(
!
conf_has_tty
(
name
))
/* no tty in the configuration */
if
(
!
conf
->
tty
)
return
0
;
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s"
,
name
);
if
(
read_info
(
path
,
"tty"
,
tty
,
sizeof
(
tty
))
<
0
)
{
SYSERROR
(
"failed to read tty info"
);
goto
out
;
}
tty_info
->
nbtty
=
atoi
(
tty
);
tty_info
->
nbtty
=
conf
->
tty
;
tty_info
->
pty_info
=
malloc
(
sizeof
(
*
tty_info
->
pty_info
)
*
tty_info
->
nbtty
);
...
...
src/lxc/conf.h
View file @
5e4a62bf
...
...
@@ -159,7 +159,7 @@ extern int lxc_unconfigure(const char *name);
extern
int
lxc_create_network
(
struct
lxc_list
*
networks
);
extern
int
lxc_assign_network
(
struct
lxc_list
*
networks
,
pid_t
pid
);
extern
int
lxc_create_tty
(
const
char
*
name
,
struct
lxc_
tty_info
*
tty_info
);
extern
int
lxc_create_tty
(
const
char
*
name
,
struct
lxc_
conf
*
conf
);
extern
void
lxc_delete_tty
(
struct
lxc_tty_info
*
tty_info
);
/*
...
...
src/lxc/start.c
View file @
5e4a62bf
...
...
@@ -276,7 +276,7 @@ struct lxc_handler *lxc_init(const char *name)
goto
out_aborting
;
}
if
(
lxc_create_tty
(
name
,
&
handler
->
conf
.
tty_info
))
{
if
(
lxc_create_tty
(
name
,
&
handler
->
conf
))
{
ERROR
(
"failed to create the ttys"
);
goto
out_aborting
;
}
...
...
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