mount: apply "nofail" to MNT_ERR_NOSOURCE libmount error
fstab: UUID=nonexist /mnt/nonexist1 ext4 nofail 0 1 # mount -av mount: can't find UUID=nonexist .. this is bug of course. Reported-by: Patrick McLean <chutzpah@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
0ce2fe8738
commit
b6bdccc710
|
@ -716,6 +716,11 @@ void *mnt_context_get_mtab_userdata(struct libmnt_context *cxt)
|
||||||
* @cxt: mount context
|
* @cxt: mount context
|
||||||
* @source: mount source (device, directory, UUID, LABEL, ...)
|
* @source: mount source (device, directory, UUID, LABEL, ...)
|
||||||
*
|
*
|
||||||
|
* Note that libmount does not interpret "nofail" (MNT_MS_NOFAIL)
|
||||||
|
* mount option. The real return code is always returned, when
|
||||||
|
* the device does not exist then it's usually MNT_ERR_NOSOURCE
|
||||||
|
* from libmount or ENOENT, ENOTDIR, ENOTBLK, ENXIO from moun(2).
|
||||||
|
*
|
||||||
* Returns: 0 on success, negative number in case of error.
|
* Returns: 0 on success, negative number in case of error.
|
||||||
*/
|
*/
|
||||||
int mnt_context_set_source(struct libmnt_context *cxt, const char *source)
|
int mnt_context_set_source(struct libmnt_context *cxt, const char *source)
|
||||||
|
|
|
@ -431,6 +431,8 @@ try_readonly:
|
||||||
warnx(_("you must specify the filesystem type"));
|
warnx(_("you must specify the filesystem type"));
|
||||||
return MOUNT_EX_USAGE;
|
return MOUNT_EX_USAGE;
|
||||||
case -MNT_ERR_NOSOURCE:
|
case -MNT_ERR_NOSOURCE:
|
||||||
|
if (uflags & MNT_MS_NOFAIL)
|
||||||
|
return MOUNT_EX_SUCCESS;
|
||||||
if (src)
|
if (src)
|
||||||
warnx(_("can't find %s"), src);
|
warnx(_("can't find %s"), src);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue