From 33eff02a448a048fc1b90e61a0f1f7a42c0507c7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 15 Sep 2010 16:27:06 +0200 Subject: [PATCH] libmount: improve debugging, fix optstr prepend Signed-off-by: Karel Zak --- shlibs/mount/src/cache.c | 4 ++-- shlibs/mount/src/optstr.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index a341efd4..d7a679b5 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -267,8 +267,6 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) return 0; } - DBG(CACHE, mnt_debug_h(cache, "reading tags for: %s", devname)); - pr = blkid_new_probe_from_filename(devname); if (!pr) return -1; @@ -281,6 +279,8 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) if (blkid_do_safeprobe(pr)) goto error; + DBG(CACHE, mnt_debug_h(cache, "reading tags for: %s", devname)); + for (i = 0; i < ARRAY_SIZE(tags); i++) { const char *data; char *dev; diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c index 6d4d3505..b809386a 100644 --- a/shlibs/mount/src/optstr.c +++ b/shlibs/mount/src/optstr.c @@ -227,7 +227,7 @@ int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value *optstr = NULL; rc = mnt_optstr_append_option(optstr, name, value); - if (!rc) + if (!rc && tmp) rc = mnt_optstr_append_option(optstr, tmp, NULL); if (!rc) { free(tmp); @@ -236,6 +236,8 @@ int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value free(*optstr); *optstr = tmp; + + DBG(OPTS, mnt_debug("failed to prepend '%s[=%s]' to '%s'", name, value, optstr)); return rc; } -- 2.39.5