diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2011-11-03 08:08:23 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-11-03 08:08:23 +1100 |
commit | c20478757de9b2746860365a3d644c441fb87f97 (patch) | |
tree | 4ec7b96dd902e932a42df01f85efd930b87b0a6e /managemon.c | |
parent | 3e1d79b2d66e06ee33df57006f1c15404f849738 (diff) |
close_aa(): Verify file descriptors are valid before trying to close them
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'managemon.c')
-rw-r--r-- | managemon.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/managemon.c b/managemon.c index fceaeb9c..cde0d8be 100644 --- a/managemon.c +++ b/managemon.c @@ -117,11 +117,16 @@ static void close_aa(struct active_array *aa) close(d->state_fd); } - close(aa->action_fd); - close(aa->info.state_fd); - close(aa->resync_start_fd); - close(aa->metadata_fd); - close(aa->sync_completed_fd); + if (aa->action_fd >= 0) + close(aa->action_fd); + if (aa->info.state_fd >= 0) + close(aa->info.state_fd); + if (aa->resync_start_fd >= 0) + close(aa->resync_start_fd); + if (aa->metadata_fd >= 0) + close(aa->metadata_fd); + if (aa->sync_completed_fd >= 0) + close(aa->sync_completed_fd); } static void free_aa(struct active_array *aa) |