FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-11-2012, 05:21 PM
Andrew Price
 
Default 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@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;
}

--
1.7.6.5
 

Thread Tools




All times are GMT. The time now is 08:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org