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
8e3ce6b0
Commit
8e3ce6b0
authored
Jul 29, 2016
by
Christian Brauner
Committed by
Stéphane Graber
Aug 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
criu: replace tmpnam() with mkstemp()
Signed-off-by:
Christian Brauner
<
cbrauner@suse.de
>
parent
d2a1437f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
criu.c
src/lxc/criu.c
+10
-4
No files found.
src/lxc/criu.c
View file @
8e3ce6b0
...
@@ -603,11 +603,13 @@ out_unlock:
...
@@ -603,11 +603,13 @@ out_unlock:
static
void
do_restore
(
struct
lxc_container
*
c
,
int
status_pipe
,
struct
migrate_opts
*
opts
,
char
*
criu_version
)
static
void
do_restore
(
struct
lxc_container
*
c
,
int
status_pipe
,
struct
migrate_opts
*
opts
,
char
*
criu_version
)
{
{
pid_t
pid
;
pid_t
pid
;
char
pidfile
[
L_tmpnam
];
struct
lxc_handler
*
handler
;
struct
lxc_handler
*
handler
;
int
status
,
pipes
[
2
]
=
{
-
1
,
-
1
};
int
fd
,
status
;
int
pipes
[
2
]
=
{
-
1
,
-
1
};
char
pidfile
[]
=
"criu_restore_XXXXXX"
;
if
(
!
tmpnam
(
pidfile
))
fd
=
mkstemp
(
pidfile
);
if
(
fd
<
0
)
goto
out
;
goto
out
;
handler
=
lxc_init
(
c
->
name
,
c
->
lxc_conf
,
c
->
config_path
);
handler
=
lxc_init
(
c
->
name
,
c
->
lxc_conf
,
c
->
config_path
);
...
@@ -756,11 +758,12 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
...
@@ -756,11 +758,12 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
goto
out_fini_handler
;
goto
out_fini_handler
;
}
else
{
}
else
{
int
ret
;
int
ret
;
FILE
*
f
=
f
open
(
pidfile
,
"r"
);
FILE
*
f
=
f
dopen
(
fd
,
"r"
);
if
(
!
f
)
{
if
(
!
f
)
{
SYSERROR
(
"couldn't read restore's init pidfile %s
\n
"
,
pidfile
);
SYSERROR
(
"couldn't read restore's init pidfile %s
\n
"
,
pidfile
);
goto
out_fini_handler
;
goto
out_fini_handler
;
}
}
fd
=
-
1
;
ret
=
fscanf
(
f
,
"%d"
,
(
int
*
)
&
handler
->
pid
);
ret
=
fscanf
(
f
,
"%d"
,
(
int
*
)
&
handler
->
pid
);
fclose
(
f
);
fclose
(
f
);
...
@@ -818,6 +821,9 @@ out:
...
@@ -818,6 +821,9 @@ out:
close
(
status_pipe
);
close
(
status_pipe
);
}
}
if
(
fd
>
0
)
close
(
fd
);
exit
(
1
);
exit
(
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