diff options
author | Karel Zak | 2012-12-04 12:12:54 +0100 |
---|---|---|
committer | Karel Zak | 2012-12-04 12:12:54 +0100 |
commit | e343695663e8c43601d25e10eccf68969288ad9b (patch) | |
tree | 62a185b585c9fd33efaac92fa5ae9078ca3a3ae5 /libblkid/src/probe.c | |
parent | libblkid: cleanup nonnull attribute usage (diff) | |
download | kernel-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/probe.c')
-rw-r--r-- | libblkid/src/probe.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index c371656a4..eabcf9010 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -461,6 +461,9 @@ int __blkid_probe_invert_filter(blkid_probe pr, int chain) size_t i; struct blkid_chain *chn; + if (!pr) + return -1; + chn = &pr->chains[chain]; if (!chn->driver->has_fltr || !chn->fltr) @@ -1397,7 +1400,7 @@ blkid_loff_t blkid_probe_get_offset(blkid_probe pr) * blkid_probe_get_fd: * @pr: probe * - * Returns: file descriptor for assigned device/file. + * Returns: file descriptor for assigned device/file or -1 in case of error. */ int blkid_probe_get_fd(blkid_probe pr) { @@ -1523,7 +1526,7 @@ int blkid_probe_has_value(blkid_probe pr, const char *name) struct blkid_prval *__blkid_probe_get_value(blkid_probe pr, int num) { - if (pr == NULL || num < 0 || num >= pr->nvals) + if (!pr || num < 0 || num >= pr->nvals) return NULL; return &pr->vals[num]; @@ -1533,7 +1536,7 @@ struct blkid_prval *__blkid_probe_lookup_value(blkid_probe pr, const char *name) { int i; - if (pr == NULL || pr->nvals == 0 || name == NULL) + if (!pr || !pr->nvals || !name) return NULL; for (i = 0; i < pr->nvals; i++) { |