summaryrefslogtreecommitdiffstats
path: root/libmount/src/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmount/src/cache.c')
-rw-r--r--libmount/src/cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libmount/src/cache.c b/libmount/src/cache.c
index fe9c821e1..220a1465e 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;
}