[CRIU] [crtools-bot] namespaces: Eliminate uninitialized 'ret' usage
Cyrill Gorcunov
gorcunov at openvz.org
Wed Feb 1 08:23:44 EST 2012
The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 7197b9467dc740d35ace3290d91c7aed69a28b26
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Wed Feb 1 15:58:30 2012 +0400
namespaces: Eliminate uninitialized 'ret' usage
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
Acked-by: Pavel Emelyanov <xemul at parallels.com>
---
namespaces.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/namespaces.c b/namespaces.c
index 67051b1..d1823ea 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -9,7 +9,8 @@
int switch_ns(int pid, int type, char *ns)
{
char buf[32];
- int nsfd, ret;
+ int nsfd;
+ int ret = -1;
snprintf(buf, sizeof(buf), "/proc/%d/ns/%s", pid, ns);
nsfd = open(buf, O_RDONLY);
@@ -30,7 +31,7 @@ out:
static int do_dump_namespaces(int ns_pid, unsigned int ns_flags)
{
struct cr_fdset *fdset;
- int ret;
+ int ret = 0;
fdset = cr_fdset_open(ns_pid, CR_FD_DESC_NS, NULL);
if (fdset == NULL)
@@ -54,7 +55,8 @@ err:
int dump_namespaces(int ns_pid, unsigned int ns_flags)
{
- int pid, ret, status;
+ int pid, status;
+ int ret = 0;
/*
* The setns syscall is cool, we can switch to the other
More information about the CRIU
mailing list