summaryrefslogtreecommitdiffstats
path: root/libblkid/src/devname.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/devname.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/devname.c')
-rw-r--r--libblkid/src/devname.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c
index 95f1d7ec9..b27b6612c 100644
--- a/libblkid/src/devname.c
+++ b/libblkid/src/devname.c
@@ -199,7 +199,7 @@ static void probe_one(blkid_cache cache, const char *ptname,
struct stat st;
char device[256];
- sprintf(device, "%s/%s", *dir, ptname);
+ snprintf(device, sizeof(device), "%s/%s", *dir, ptname);
if ((dev = blkid_get_dev(cache, device, BLKID_DEV_FIND)) &&
dev->bid_devno == devno)
goto set_pri;
@@ -595,9 +595,11 @@ int blkid_probe_all(blkid_cache cache)
DBG(DEBUG_PROBE, printf("Begin blkid_probe_all()\n"));
ret = probe_all(cache, 0);
- cache->bic_time = time(0);
- cache->bic_flags |= BLKID_BIC_FL_PROBED;
- DBG(DEBUG_PROBE, printf("End blkid_probe_all()\n"));
+ if (ret == 0) {
+ cache->bic_time = time(0);
+ cache->bic_flags |= BLKID_BIC_FL_PROBED;
+ }
+ DBG(DEBUG_PROBE, printf("End blkid_probe_all() [rc=%d]\n", ret));
return ret;
}
@@ -615,7 +617,7 @@ int blkid_probe_all_new(blkid_cache cache)
DBG(DEBUG_PROBE, printf("Begin blkid_probe_all_new()\n"));
ret = probe_all(cache, 1);
- DBG(DEBUG_PROBE, printf("End blkid_probe_all_new()\n"));
+ DBG(DEBUG_PROBE, printf("End blkid_probe_all_new() [rc=%d]\n", ret));
return ret;
}
@@ -643,7 +645,7 @@ int blkid_probe_all_removable(blkid_cache cache)
DBG(DEBUG_PROBE, printf("Begin blkid_probe_all_removable()\n"));
ret = probe_all_removable(cache);
- DBG(DEBUG_PROBE, printf("End blkid_probe_all_removable()\n"));
+ DBG(DEBUG_PROBE, printf("End blkid_probe_all_removable() [rc=%d]\n", ret));
return ret;
}