From 8342e5840dd862d2d13f3b8be38dfa070c8d7236 Mon Sep 17 00:00:00 2001 From: Vaclav Dolezal Date: Tue, 13 Mar 2018 14:45:43 +0100 Subject: libmount: added error MNT_ERR_NAMESPACE Signed-off-by: Vaclav Dolezal --- libmount/src/context_mount.c | 8 ++++++++ libmount/src/context_umount.c | 8 ++++++++ libmount/src/libmount.h.in | 6 ++++++ 3 files changed, 22 insertions(+) (limited to 'libmount/src') diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 6207bd814..9245d73dd 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -1452,6 +1452,10 @@ int mnt_context_get_mount_excode( if (buf) snprintf(buf, bufsz, _("locking failed")); return MNT_EX_FILEIO; + case -MNT_ERR_NAMESPACE: + if (buf) + snprintf(buf, bufsz, _("failed to switch namespace")); + return MNT_EX_SYSERR; default: return mnt_context_get_generic_excode(rc, buf, bufsz, _("mount failed: %m")); } @@ -1465,6 +1469,10 @@ int mnt_context_get_mount_excode( if (buf) snprintf(buf, bufsz, _("filesystem was mounted, but failed to update userspace mount table")); return MNT_EX_FILEIO; + } else if (rc == -MNT_ERR_NAMESPACE) { + if (buf) + snprintf(buf, bufsz, _("filesystem was mounted, but failed to switch namespace back")); + return MNT_EX_SYSERR; } else if (rc < 0) return mnt_context_get_generic_excode(rc, buf, bufsz, diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index 81a650352..3e320bec9 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -1076,6 +1076,10 @@ int mnt_context_get_umount_excode( if (buf) snprintf(buf, bufsz, _("locking failed")); return MNT_EX_FILEIO; + } else if (rc == -MNT_ERR_NAMESPACE) { + if (buf) + snprintf(buf, bufsz, _("failed to switch namespace")); + return MNT_EX_SYSERR; } return mnt_context_get_generic_excode(rc, buf, bufsz, _("umount failed: %m")); @@ -1089,6 +1093,10 @@ int mnt_context_get_umount_excode( if (buf) snprintf(buf, bufsz, _("filesystem was unmounted, but failed to update userspace mount table")); return MNT_EX_FILEIO; + } else if (rc == -MNT_ERR_NAMESPACE) { + if (buf) + snprintf(buf, bufsz, _("filesystem was unmounted, but failed to switch namespace back")); + return MNT_EX_SYSERR; } else if (rc < 0) return mnt_context_get_generic_excode(rc, buf, bufsz, diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in index 885729dfb..3a9440371 100644 --- a/libmount/src/libmount.h.in +++ b/libmount/src/libmount.h.in @@ -205,6 +205,12 @@ enum { * failed to lock mtab/utab or so. */ #define MNT_ERR_LOCK 5008 +/** + * MNT_ERR_NAMESPACE: + * + * failed to switch namespace + */ +#define MNT_ERR_NAMESPACE 5009 /* -- cgit v1.2.3-55-g7522