summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2014-10-07 12:44:34 +0200
committerKarel Zak <kzak@redhat.com>2014-10-24 11:10:06 +0200
commit98b539c25caede8534ffaf06e67a694eeb3bc6cb (patch)
treeee5274e00fc92644f6aa700e301e514256c654bb
parent7b4e8472595a971fc3c1c006b0c189a8ab665f73 (diff)
downloadutil-linux-98b539c25caede8534ffaf06e67a694eeb3bc6cb.tar.gz
libblkid: zeroize errno on blkid_probe_get_buffer() success
Since 37f4060225df0591ab8e1dd676dbc8115d900d4f prober functions are sensitive to errno, it seems more robust to set errno=0 with in blkid_probe_get_buffer() on success than set the zero on all places where we call blkid_probe_get_buffer(). Addresses: https://github.com/karelzak/util-linux/issues/119 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--libblkid/src/probe.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index b1eddd628..2bd0d738b 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -538,8 +538,10 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr,
struct list_head *p;
struct blkid_bufinfo *bf = NULL;
- if (pr->size <= 0)
+ if (pr->size <= 0) {
+ errno = EINVAL;
return NULL;
+ }
if (pr->parent &&
pr->parent->devno == pr->devno &&
@@ -601,6 +603,7 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr,
list_add_tail(&bf->bufs, &pr->buffers);
}
+ errno = 0;
return off ? bf->data + (off - bf->off) : bf->data;
}