summaryrefslogtreecommitdiff
path: root/libparted/cs
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-05-30 13:09:01 +0200
committerJim Meyering <meyering@redhat.com>2011-05-30 13:09:01 +0200
commit24e337d5fb734d64000058f58fbdd6ffe2a0a90e (patch)
treeabbb50b7aad3fe6fbc0cac2f93bf8f86e8d22bf1 /libparted/cs
parent5e3897f35041c16fd58fc11ed603d8fc0b44736c (diff)
downloadparted-24e337d5fb734d64000058f58fbdd6ffe2a0a90e.tar.gz
maint: placate coverity: don't ignore some return values
* libparted/cs/constraint.c: Include <assert.h>. (ped_constraint_exact): Don't ignore ped_alignment_init's return value or that from ped_geometry_init.
Diffstat (limited to 'libparted/cs')
-rw-r--r--libparted/cs/constraint.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libparted/cs/constraint.c b/libparted/cs/constraint.c
index f4181c5..e0f4c4d 100644
--- a/libparted/cs/constraint.c
+++ b/libparted/cs/constraint.c
@@ -46,6 +46,7 @@
#include <config.h>
#include <parted/parted.h>
#include <parted/debug.h>
+#include <assert.h>
/**
* Initializes a pre-allocated piece of memory to contain a constraint
@@ -511,11 +512,20 @@ ped_constraint_exact (const PedGeometry* geom)
PedAlignment end_align;
PedGeometry start_sector;
PedGeometry end_sector;
-
- ped_alignment_init (&start_align, geom->start, 0);
- ped_alignment_init (&end_align, geom->end, 0);
- ped_geometry_init (&start_sector, geom->dev, geom->start, 1);
- ped_geometry_init (&end_sector, geom->dev, geom->end, 1);
+ int ok;
+
+ /* With grain size of 0, it always succeeds. */
+ ok = ped_alignment_init (&start_align, geom->start, 0);
+ assert (ok);
+ ok = ped_alignment_init (&end_align, geom->end, 0);
+ assert (ok);
+
+ ok = ped_geometry_init (&start_sector, geom->dev, geom->start, 1);
+ if (!ok)
+ return NULL;
+ ok = ped_geometry_init (&end_sector, geom->dev, geom->end, 1);
+ if (!ok)
+ return NULL;
return ped_constraint_new (&start_align, &end_align,
&start_sector, &end_sector, 1,