summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 4fea3ccb4..3f7e43bec 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -539,8 +539,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 &&
@@ -602,6 +604,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;
}