diff options
author | Karel Zak <kzak@redhat.com> | 2012-06-21 10:40:43 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2012-06-21 10:40:43 +0200 |
commit | defa0710b63096f96b5616090c262d30b01bc60c (patch) | |
tree | 78e997be96600df083f7bca8c704c0352605b190 /libmount/src | |
parent | 1aae31c0488299023346bd2b4f8a8046a8546a8c (diff) | |
download | util-linux-defa0710b63096f96b5616090c262d30b01bc60c.tar.gz |
lib/loopdev: use warn_unused_result forimportant functions
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
-rw-r--r-- | libmount/src/cache.c | 5 | ||||
-rw-r--r-- | libmount/src/context_loopdev.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/libmount/src/cache.c b/libmount/src/cache.c index fe9c821e..220a1465 100644 --- a/libmount/src/cache.c +++ b/libmount/src/cache.c @@ -487,8 +487,8 @@ char *mnt_pretty_path(const char *path, struct libmnt_cache *cache) if (strncmp(pretty, "/dev/loop", 9) == 0) { struct loopdev_cxt lc; - loopcxt_init(&lc, 0); - loopcxt_set_device(&lc, pretty); + if (loopcxt_init(&lc, 0) || loopcxt_set_device(&lc, pretty)) + goto done; if (loopcxt_is_autoclear(&lc)) { char *tmp = loopcxt_get_backing_file(&lc); @@ -502,6 +502,7 @@ char *mnt_pretty_path(const char *path, struct libmnt_cache *cache) } +done: /* don't return pointer to the cache, allocate a new string */ return cache ? strdup(pretty) : pretty; } diff --git a/libmount/src/context_loopdev.c b/libmount/src/context_loopdev.c index 290e0d3d..da246e3b 100644 --- a/libmount/src/context_loopdev.c +++ b/libmount/src/context_loopdev.c @@ -155,7 +155,9 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) lo_flags |= LO_FLAGS_READ_ONLY; } - loopcxt_init(&lc, 0); + rc = loopcxt_init(&lc, 0); + if (rc) + return rc; ON_DBG(CXT, loopcxt_enable_debug(&lc, 1)); |