summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2023-05-17 13:42:01 +0200
committerKarel Zak <kzak@redhat.com>2023-05-17 13:42:01 +0200
commitd3edf0f8de6de4ad3ff7e1d62bd6b271a576538e (patch)
treee5809d5b118984f148b40a89e4c91c9565c6fd32
parentbd2ebbd4eadd29efac994037c0e85e8ddad13248 (diff)
parent91ea38e91d6f1b37edc3114e02a4984a54918426 (diff)
downloadutil-linux-d3edf0f8de6de4ad3ff7e1d62bd6b271a576538e.tar.gz
Merge branch 'libmount/syscall'
-rw-r--r--libmount/src/context_mount.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index 5aae4bea0..d6504c4a4 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -1552,7 +1552,6 @@ int mnt_context_get_mount_excode(
*/
syserr = mnt_context_get_syscall_errno(cxt);
-
switch(syserr) {
case EPERM:
if (!buf)
@@ -1595,10 +1594,8 @@ int mnt_context_get_mount_excode(
return MNT_EX_SUCCESS;
if (buf)
snprintf(buf, bufsz, _("special device %s does not exist"), src);
- } else if (buf) {
- errno = syserr;
- snprintf(buf, bufsz, _("mount(2) system call failed: %m"));
- }
+ } else
+ goto generic_error;
break;
case ENOTDIR:
@@ -1611,10 +1608,8 @@ int mnt_context_get_mount_excode(
if (buf)
snprintf(buf, bufsz, _("special device %s does not exist "
"(a path prefix is not a directory)"), src);
- } else if (buf) {
- errno = syserr;
- snprintf(buf, bufsz, _("mount(2) system call failed: %m"));
- }
+ } else
+ goto generic_error;
break;
case EINVAL:
@@ -1695,10 +1690,8 @@ int mnt_context_get_mount_excode(
snprintf(buf, bufsz, _("cannot remount %s read-write, is write-protected"), src);
else if (mflags & MS_BIND)
snprintf(buf, bufsz, _("bind %s failed"), src);
- else {
- errno = syserr;
- snprintf(buf, bufsz, _("mount(2) system call failed: %m"));
- }
+ else
+ goto generic_error;
break;
case ENOMEDIUM:
@@ -1718,9 +1711,11 @@ int mnt_context_get_mount_excode(
/* fallthrough */
default:
+ generic_error:
if (buf) {
errno = syserr;
- snprintf(buf, bufsz, _("mount(2) system call failed: %m"));
+ snprintf(buf, bufsz, _("%s system call failed: %m"),
+ cxt->syscall_name ? : "mount");
}
break;
}