summaryrefslogtreecommitdiffstats
path: root/libmount/src/context.c
diff options
context:
space:
mode:
authorKarel Zak2013-02-13 12:36:10 +0100
committerKarel Zak2013-02-13 12:36:10 +0100
commit82a2c1600ddc50b6c0bf0f521035b9b82a6e0a8e (patch)
tree26385585e61af105caa694a830b9fa55f254f649 /libmount/src/context.c
parentchfn: Add libuser support (diff)
downloadkernel-qcow2-util-linux-82a2c1600ddc50b6c0bf0f521035b9b82a6e0a8e.tar.gz
kernel-qcow2-util-linux-82a2c1600ddc50b6c0bf0f521035b9b82a6e0a8e.tar.xz
kernel-qcow2-util-linux-82a2c1600ddc50b6c0bf0f521035b9b82a6e0a8e.zip
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 <lczerner@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context.c')
-rw-r--r--libmount/src/context.c9
1 files changed, 6 insertions, 3 deletions
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");