diff options
author | Karel Zak | 2012-05-28 12:49:55 +0200 |
---|---|---|
committer | Karel Zak | 2012-05-28 12:49:55 +0200 |
commit | 61f5ff6cb4e094b77279b7d52be0d7cc3bb13f72 (patch) | |
tree | 65664f52534d560ba46ae10ac70f1c14700ba19f /libmount | |
parent | mount: (new) add loopdev specific error message (diff) | |
download | kernel-qcow2-util-linux-61f5ff6cb4e094b77279b7d52be0d7cc3bb13f72.tar.gz kernel-qcow2-util-linux-61f5ff6cb4e094b77279b7d52be0d7cc3bb13f72.tar.xz kernel-qcow2-util-linux-61f5ff6cb4e094b77279b7d52be0d7cc3bb13f72.zip |
libmount: add MNT_ERR_MOUNTOPT
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount')
-rw-r--r-- | libmount/src/context_loopdev.c | 8 | ||||
-rw-r--r-- | libmount/src/context_mount.c | 3 | ||||
-rw-r--r-- | libmount/src/libmount.h.in | 1 | ||||
-rw-r--r-- | libmount/src/utils.c | 2 |
4 files changed, 12 insertions, 2 deletions
diff --git a/libmount/src/context_loopdev.c b/libmount/src/context_loopdev.c index 0dcf5803e..290e0d3d2 100644 --- a/libmount/src/context_loopdev.c +++ b/libmount/src/context_loopdev.c @@ -181,8 +181,10 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) if (rc == 0 && (cxt->user_mountflags & MNT_MS_OFFSET) && mnt_optstr_get_option(optstr, "offset", &val, &len) == 0) { rc = mnt_parse_offset(val, len, &offset); - if (rc) + if (rc) { DBG(CXT, mnt_debug_h(cxt, "failed to parse offset=")); + rc = -MNT_ERR_MOUNTOPT; + } } /* @@ -191,8 +193,10 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt) if (rc == 0 && (cxt->user_mountflags & MNT_MS_SIZELIMIT) && mnt_optstr_get_option(optstr, "sizelimit", &val, &len) == 0) { rc = mnt_parse_offset(val, len, &sizelimit); - if (rc) + if (rc) { DBG(CXT, mnt_debug_h(cxt, "failed to parse sizelimit=")); + rc = -MNT_ERR_MOUNTOPT; + } } /* diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 63091b7f8..3f0001dd4 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -141,6 +141,9 @@ done: DBG(CXT, mnt_debug_h(cxt, "fixed options [rc=%d]: " "vfs: '%s' fs: '%s' user: '%s', optstr: '%s'", rc, fs->vfs_optstr, fs->fs_optstr, fs->user_optstr, fs->optstr)); + + if (rc) + rc = -MNT_ERR_MOUNTOPT; return rc; } diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in index 5161cf7c9..e12243962 100644 --- a/libmount/src/libmount.h.in +++ b/libmount/src/libmount.h.in @@ -127,6 +127,7 @@ enum { #define MNT_ERR_NOFSTYPE 5001 /* failed to detect filesystem type */ #define MNT_ERR_NOSOURCE 5002 /* required mount source undefined */ #define MNT_ERR_LOOPDEV 5003 /* loopdev setup failed, errno set by libc */ +#define MNT_ERR_MOUNTOPT 5004 /* failed to parse/use userspace mount options */ /* init.c */ extern void mnt_init_debug(int mask); diff --git a/libmount/src/utils.c b/libmount/src/utils.c index 336fe8de8..d4cc0b3ed 100644 --- a/libmount/src/utils.c +++ b/libmount/src/utils.c @@ -539,6 +539,7 @@ int mnt_get_uid(const char *username, uid_t *uid) } else { DBG(UTILS, mnt_debug( "cannot convert '%s' username to UID", username)); + rc = errno ? -errno : -EINVAL; } free(buf); @@ -566,6 +567,7 @@ int mnt_get_gid(const char *groupname, gid_t *gid) } else { DBG(UTILS, mnt_debug( "cannot convert '%s' groupname to GID", groupname)); + rc = errno ? -errno : -EINVAL; } free(buf); |