gfs2-utils: master - mkfs.gfs2: Fix use of uninitialized value in check_dev_content
Andrew Price
andyp at fedoraproject.org
Wed Jan 11 18:39:53 UTC 2012
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=cc9d928ea783b661c74317b3d677712b56bd4447
Commit: cc9d928ea783b661c74317b3d677712b56bd4447
Parent: d202019cc0024f132d07d5831eb84473b1e873f3
Author: Andrew Price <anprice at redhat.com>
AuthorDate: Mon Jan 9 04:51:32 2012 +0000
Committer: Andrew Price <anprice at redhat.com>
CommitterDate: Wed Jan 11 18:17:56 2012 +0000
mkfs.gfs2: Fix use of uninitialized value in check_dev_content
Spotted by coverity: Using uninitialized value "p[0]" when calling
"close".
Signed-off-by: Andrew Price <anprice at redhat.com>
---
gfs2/mkfs/main_mkfs.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 95afe41..3658fd4 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -428,7 +428,7 @@ static void check_dev_content(const char *devname)
(char *)"-bs",
(char *)devname,
NULL };
- int p[2];
+ int p[2] = {-1, -1};
int ret;
int pid;
@@ -463,7 +463,8 @@ fail:
goto fail;
printf( _("It appears to contain: %s"), content);
}
- close(p[0]);
+ if (p[0] >= 0)
+ close(p[0]);
return;
}
More information about the cluster-commits
mailing list