From 82a2c1600ddc50b6c0bf0f521035b9b82a6e0a8e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 13 Feb 2013 12:36:10 +0100 Subject: libmount: correctly propagate ambivalent blkid probing results libmount ignores "ambivalent probing result" from libblkid and tries filesystems /etc/filesystems. This is incorrect behavior. Reported-by: Lukas Czerner Signed-off-by: Karel Zak --- libmount/src/context.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libmount/src/context.c') diff --git a/libmount/src/context.c b/libmount/src/context.c index 6d5703834..2e2a161dd 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -146,7 +146,6 @@ int mnt_reset_context(struct libmnt_context *cxt) cxt->fs = NULL; cxt->mtab = NULL; - cxt->ambi = 0; cxt->helper = NULL; cxt->orig_user = NULL; cxt->mountflags = 0; @@ -1514,13 +1513,16 @@ int mnt_context_guess_fstype(struct libmnt_context *cxt) if (access(dev, F_OK) == 0) { struct libmnt_cache *cache = mnt_context_get_cache(cxt); + int ambi = 0; - type = mnt_get_fstype(dev, &cxt->ambi, cache); + type = mnt_get_fstype(dev, &ambi, cache); if (type) { rc = mnt_fs_set_fstype(cxt->fs, type); if (!cache) free(type); /* type is not cached */ } + if (ambi) + rc = -MNT_ERR_AMBIFS; } else { if (strchr(dev, ':') != NULL) rc = mnt_fs_set_fstype(cxt->fs, "nfs"); @@ -1529,7 +1531,8 @@ int mnt_context_guess_fstype(struct libmnt_context *cxt) } done: - DBG(CXT, mnt_debug_h(cxt, "FS type: %s", mnt_fs_get_fstype(cxt->fs))); + DBG(CXT, mnt_debug_h(cxt, "FS type: %s [rc=%d]", + mnt_fs_get_fstype(cxt->fs), rc)); return rc; none: return mnt_fs_set_fstype(cxt->fs, "none"); -- cgit v1.2.3-55-g7522