dump: Don't loose dump_namespaces error

Submitted by Cyrill Gorcunov on June 4, 2018, 5:17 p.m.

Details

Message ID 20180604171757.22543-1-gorcunov@gmail.com
State Accepted
Series "dump: Don't loose dump_namespaces error"
Headers show

Commit Message

Cyrill Gorcunov June 4, 2018, 5:17 p.m.
In case if dump_namespaces failed we may have
ret shadowed and erroneously report checkpoint
success.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/cr-dump.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index fb308196594a..2103de480ba9 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1988,9 +1988,11 @@  int cr_dump_tasks(pid_t pid)
 	if (ret)
 		goto err;
 
-	if (root_ns_mask)
-		if (dump_namespaces(root_item, root_ns_mask) < 0)
+	if (root_ns_mask) {
+		ret = dump_namespaces(root_item, root_ns_mask);
+		if (ret)
 			goto err;
+	}
 
 	ret = dump_cgroups();
 	if (ret)

Comments

Andrey Vagin June 6, 2018, 7:13 p.m.
Applied, thanks!

On Mon, Jun 04, 2018 at 08:17:57PM +0300, Cyrill Gorcunov wrote:
> In case if dump_namespaces failed we may have
> ret shadowed and erroneously report checkpoint
> success.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>  criu/cr-dump.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/cr-dump.c b/criu/cr-dump.c
> index fb308196594a..2103de480ba9 100644
> --- a/criu/cr-dump.c
> +++ b/criu/cr-dump.c
> @@ -1988,9 +1988,11 @@ int cr_dump_tasks(pid_t pid)
>  	if (ret)
>  		goto err;
>  
> -	if (root_ns_mask)
> -		if (dump_namespaces(root_item, root_ns_mask) < 0)
> +	if (root_ns_mask) {
> +		ret = dump_namespaces(root_item, root_ns_mask);
> +		if (ret)
>  			goto err;
> +	}
>  
>  	ret = dump_cgroups();
>  	if (ret)
> -- 
> 2.14.4
>