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
c80de904
Commit
c80de904
authored
Jul 08, 2016
by
Serge Hallyn
Committed by
GitHub
Jul 08, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1073 from brauner/bugfix_branch
store criu version
parents
b9aae26f
5407e2ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
criu.c
src/lxc/criu.c
+21
-7
No files found.
src/lxc/criu.c
View file @
c80de904
...
@@ -410,8 +410,11 @@ err:
...
@@ -410,8 +410,11 @@ err:
*
*
* The intent is that when criu development slows down, we can drop this, but
* The intent is that when criu development slows down, we can drop this, but
* for now we shouldn't attempt to c/r with versions that we know won't work.
* for now we shouldn't attempt to c/r with versions that we know won't work.
*
* Note: If version != NULL criu_version() stores the detected criu version in
* version. Allocates memory for version which must be freed by caller.
*/
*/
static
bool
criu_version_ok
()
static
bool
criu_version_ok
(
char
**
version
)
{
{
int
pipes
[
2
];
int
pipes
[
2
];
pid_t
pid
;
pid_t
pid
;
...
@@ -444,7 +447,7 @@ static bool criu_version_ok()
...
@@ -444,7 +447,7 @@ static bool criu_version_ok()
exit
(
1
);
exit
(
1
);
}
else
{
}
else
{
FILE
*
f
;
FILE
*
f
;
char
version
[
1024
]
;
char
*
tmp
;
int
patch
;
int
patch
;
close
(
pipes
[
1
]);
close
(
pipes
[
1
]);
...
@@ -460,16 +463,22 @@ static bool criu_version_ok()
...
@@ -460,16 +463,22 @@ static bool criu_version_ok()
return
false
;
return
false
;
}
}
if
(
fscanf
(
f
,
"Version: %1023[^
\n
]s"
,
version
)
!=
1
)
tmp
=
malloc
(
1024
);
if
(
!
tmp
)
{
fclose
(
f
);
return
false
;
}
if
(
fscanf
(
f
,
"Version: %1023[^
\n
]s"
,
tmp
)
!=
1
)
goto
version_error
;
goto
version_error
;
if
(
fgetc
(
f
)
!=
'\n'
)
if
(
fgetc
(
f
)
!=
'\n'
)
goto
version_error
;
goto
version_error
;
if
(
strcmp
(
version
,
CRIU_VERSION
)
>=
0
)
if
(
strcmp
(
tmp
,
CRIU_VERSION
)
>=
0
)
goto
version_match
;
goto
version_match
;
if
(
fscanf
(
f
,
"GitID: v%1023[^-]s"
,
version
)
!=
1
)
if
(
fscanf
(
f
,
"GitID: v%1023[^-]s"
,
tmp
)
!=
1
)
goto
version_error
;
goto
version_error
;
if
(
fgetc
(
f
)
!=
'-'
)
if
(
fgetc
(
f
)
!=
'-'
)
...
@@ -478,7 +487,7 @@ static bool criu_version_ok()
...
@@ -478,7 +487,7 @@ static bool criu_version_ok()
if
(
fscanf
(
f
,
"%d"
,
&
patch
)
!=
1
)
if
(
fscanf
(
f
,
"%d"
,
&
patch
)
!=
1
)
goto
version_error
;
goto
version_error
;
if
(
strcmp
(
version
,
CRIU_GITID_VERSION
)
<
0
)
if
(
strcmp
(
tmp
,
CRIU_GITID_VERSION
)
<
0
)
goto
version_error
;
goto
version_error
;
if
(
patch
<
CRIU_GITID_PATCHLEVEL
)
if
(
patch
<
CRIU_GITID_PATCHLEVEL
)
...
@@ -486,10 +495,15 @@ static bool criu_version_ok()
...
@@ -486,10 +495,15 @@ static bool criu_version_ok()
version_match:
version_match:
fclose
(
f
);
fclose
(
f
);
if
(
!
version
)
free
(
tmp
);
else
*
version
=
tmp
;
return
true
;
return
true
;
version_error:
version_error:
fclose
(
f
);
fclose
(
f
);
free
(
tmp
);
ERROR
(
"must have criu "
CRIU_VERSION
" or greater to checkpoint/restore
\n
"
);
ERROR
(
"must have criu "
CRIU_VERSION
" or greater to checkpoint/restore
\n
"
);
return
false
;
return
false
;
}
}
...
@@ -501,7 +515,7 @@ static bool criu_ok(struct lxc_container *c)
...
@@ -501,7 +515,7 @@ static bool criu_ok(struct lxc_container *c)
{
{
struct
lxc_list
*
it
;
struct
lxc_list
*
it
;
if
(
!
criu_version_ok
())
if
(
!
criu_version_ok
(
NULL
))
return
false
;
return
false
;
if
(
geteuid
())
{
if
(
geteuid
())
{
...
...
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