diff options
author | Karel Zak <kzak@redhat.com> | 2014-09-16 15:30:03 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2014-10-24 10:08:07 +0200 |
commit | ecb2eae67c570428f5ecd1a297b59773c1eaf3e5 (patch) | |
tree | eae54209778be2768509acbc367857545360aced | |
parent | 868c07ea59ad0ea483e269bed4a1422daa3f343f (diff) | |
download | util-linux-ecb2eae67c570428f5ecd1a297b59773c1eaf3e5.tar.gz |
libmount: hide details about failed search in fstab/mtab
The current code returns -errno when not found "mount /foo" in fstab
and mtab does not exist (or /etc/mtab points to non-mounted /proc).
This is problem because the return value is too low-level and maybe
misinterpreted by top level code. It's better to always return
MNT_ERR_NOFSTAB when not found in fstab/mtab.
Reported-by: Dylan Cali <calid1984@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | libmount/src/context.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c index 7d2b9e40f..48ee985fa 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -2050,8 +2050,14 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt) if (!rc) rc = apply_table(cxt, tab, MNT_ITER_BACKWARD); } - if (rc) - DBG(CXT, ul_debugobj(cxt, "failed to find entry in fstab/mtab")); + if (rc) { + DBG(CXT, ul_debugobj(cxt, "failed to find entry in fstab/mtab [rc=%d]: %m", rc)); + + /* force to "not found in fstab/mtab" error, the details why + * not found are not so important and may be misinterpreted by + * applications... */ + rc = -MNT_ERR_NOFSTAB; + } return rc; } |