blkid_dev_has_tag() will immediately return -1 (an error if value is
NULL. Thus at the test later on value cannot be NULL. There are two
possible ways to go about fixing this. The first would be to remove the
first NULL check for value. The second one would be to remove the
second check (and the deadcode).
I chose the second path because the functionality added is something
which a programmer could reasonably expect given the function name, and
it is highly unlikely any existing code is depending on the fact that
blkid_dev_has_tag() will return an error if value is NULL.
Coverity ID: 3: Deadcode
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+2007-03-18 Theodore Tso <tytso@mit.edu>
+
+ * tag.c (blkid_dev_has_tag): Allow value to be NULL, in which case
+ blkid_dev_has_tag() will return TRUE if the passed-in tag
+ exists --- reasonable functionality given the function name.
+
2007-03-06 Theodore Tso <tytso@mit.edu>
* devname.c (dm_probe_all), probe.c (blkid_verify): Fix memory
{
blkid_tag tag;
- if (!dev || !type || !value)
+ if (!dev || !type)
return -1;
tag = blkid_find_tag_dev(dev, type);
if (!value)
- return(tag != NULL);
+ return (tag != NULL);
if (!tag || strcmp(tag->bit_val, value))
return 0;
return 1;