mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-04 07:43:23 +00:00
No description
blcrcheckpointcontainercontainerscriudmtcphighly-availablelinuxmemory-trackingmigrationparasitepost-copyrestoresnapshotsuspenduserfaultfdzero-downtime
The following error is emitted by clang:
> CC criu/filesystems.o
> criu/filesystems.c:280:13: error: variable 'ret' is used uninitialized
> whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> } else if (bme->extension) {
> ^~~~~~~~~~~~~~
> criu/filesystems.c:287:6: note: uninitialized use occurs here
> if (ret > 0) {
> ^~~
> criu/filesystems.c:280:9: note: remove the 'if' if its condition is
> always true
> } else if (bme->extension) {
> ^~~~~~~~~~~~~~~~~~~~
> criu/filesystems.c:272:9: note: initialize the variable 'ret' to silence
> this warning
> int ret;
> ^
> = 0
> 1 error generated.
This code was a result of commit 398e7d3.
If we look closely, this is a false alarm, as "else if (bme->extension)"
is always true as it was checked before. But this is not very clear,
and the issue with clangs still needs to be fixed.
There are many ways to do so:
1. Initialize ret to 0. This is what initial version of this patch did.
2. Remove the always-true condition, like this:
- } else if (bme->extension) {
+ } else {
In my opinion this would hurt readability.
3. Change the code flow, improving readability at the same time.
I believe that #3 is what this patch does. In addition, it fixes
handling of a few corner cases:
- an overflow in snprintf();
- a case when bme->name is NULL (as it is used for strlen/snprintf,
there is a potential for SIGSEGV);
- a case of ret == 0 (currently there is no code flow that
results in ret being 0, so it's just for the future).
[v2: use linux kernel style for 'else' after a block]
[xemul: Fix // comments ]
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
|
||
|---|---|---|
| contrib | ||
| coredump | ||
| crit | ||
| criu | ||
| Documentation | ||
| images | ||
| lib | ||
| scripts | ||
| test | ||
| .gitignore | ||
| .mailmap | ||
| .travis.yml | ||
| COPYING | ||
| CREDITS | ||
| INSTALL.md | ||
| Makefile | ||
| Makefile.install | ||
| Makefile.versions | ||
| README.md | ||
CRIU (Checkpoint and Restore in Userspace)
An utility to checkpoint/restore tasks. Using this tool, you can freeze a running application (or part of it) and checkpoint it to a hard drive as a collection of files. You can then use the files to restore and run the application from the point it was frozen at. The distinctive feature of the CRIU project is that it is mainly implemented in user space.
The project home is at http://criu.org.
Pages worth starting with are:
- Kernel configuration, compilation, etc
- A simple example of usage
- More sophisticated example with graphical app
A video tour on basic CRIU features
How to contribute
- How to submit patches;
- Send all bug reports to mailing list;
- Spread the word about CRIU in social networks;
