summaryrefslogtreecommitdiffstats
path: root/libblkid/src/tag.c
diff options
context:
space:
mode:
authorKarel Zak2012-12-04 12:12:54 +0100
committerKarel Zak2012-12-04 12:12:54 +0100
commite343695663e8c43601d25e10eccf68969288ad9b (patch)
tree62a185b585c9fd33efaac92fa5ae9078ca3a3ae5 /libblkid/src/tag.c
parentlibblkid: cleanup nonnull attribute usage (diff)
downloadkernel-qcow2-util-linux-e343695663e8c43601d25e10eccf68969288ad9b.tar.gz
kernel-qcow2-util-linux-e343695663e8c43601d25e10eccf68969288ad9b.tar.xz
kernel-qcow2-util-linux-e343695663e8c43601d25e10eccf68969288ad9b.zip
libblkid: cleanup arguments checks
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/tag.c')
-rw-r--r--libblkid/src/tag.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c
index 8fe333634..9dbacef04 100644
--- a/libblkid/src/tag.c
+++ b/libblkid/src/tag.c
@@ -86,9 +86,6 @@ extern int blkid_dev_has_tag(blkid_dev dev, const char *type,
{
blkid_tag tag;
- if (!dev || !type)
- return -1;
-
tag = blkid_find_tag_dev(dev, type);
if (!value)
return (tag != NULL);
@@ -242,12 +239,15 @@ int blkid_parse_tag_string(const char *token, char **ret_type, char **ret_val)
goto errout; /* missing closing quote */
*cp = '\0';
}
- value = strdup(value);
+ if (value && *value)
+ value = strdup(value);
if (!value)
goto errout;
- *ret_type = name;
- *ret_val = value;
+ if (ret_type)
+ *ret_type = name;
+ if (ret_val)
+ *ret_val = value;
return 0;
@@ -300,11 +300,13 @@ extern int blkid_tag_next(blkid_tag_iterate iter,
{
blkid_tag tag;
- *type = 0;
- *value = 0;
- if (!iter || iter->magic != TAG_ITERATE_MAGIC ||
+ if (!type || !value ||
+ !iter || iter->magic != TAG_ITERATE_MAGIC ||
iter->p == &iter->dev->bid_tags)
return -1;
+
+ *type = 0;
+ *value = 0;
tag = list_entry(iter->p, struct blkid_struct_tag, bit_tags);
*type = tag->bit_name;
*value = tag->bit_val;