util-linux/mount-new-use-MNT_ERR-for-error-messages.patch
Petr Uzel 5b9d0884d3 - improve error messages from new mount (bnc#767208)
- backport patches from upstream git:
  - mount-new-add-loopdev-specific-error-message.patch
  - mount-new-use-MNT_ERR-for-error-messages.patch
  - libmount-add-special-MNT_ERR-codes.patch
  - mount-new-improve-error-messages.patch
  - libmount-add-MNT_ERR_LOOPDEV.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=139
2012-06-15 13:00:49 +00:00

57 lines
1.7 KiB
Diff

From ba24923e97e099668b8c96dba9596c90cb58c417 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 24 Apr 2012 11:59:18 +0200
Subject: [PATCH] mount: (new) use MNT_ERR_ for error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
sys-utils/mount.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
Index: util-linux-2.21.2/sys-utils/mount.c
===================================================================
--- util-linux-2.21.2.orig/sys-utils/mount.c
+++ util-linux-2.21.2/sys-utils/mount.c
@@ -365,29 +365,28 @@ try_readonly:
case -EBUSY:
warnx(_("%s is already mounted"), src);
return MOUNT_EX_USAGE;
- }
-
- if (!tgt || (!src && !(mflags & MS_PROPAGATION))) {
- if (!mnt_context_fstab_applied(cxt))
+ case -MNT_ERR_NOFSTAB:
warnx(_("can't find %s in %s"), src ? src : tgt,
mnt_get_fstab_path());
- else if (mflags & MS_REMOUNT)
- warnx(_("%s not mounted"), src ? src : tgt);
-
return MOUNT_EX_USAGE;
- }
-
- if (!mnt_context_get_fstype(cxt)) {
+ case -MNT_ERR_NOFSTYPE:
if (restricted)
warnx(_("I could not determine the filesystem type, "
"and none was specified"));
else
warnx(_("you must specify the filesystem type"));
return MOUNT_EX_USAGE;
- }
+ case -MNT_ERR_NOSOURCE:
+ if (src)
+ warnx(_("can't find %s"), src);
+ else
+ warnx(_("mount source not defined"));
+ return MOUNT_EX_USAGE;
+
+ default:
return handle_generic_errors(rc, _("%s: mount failed"),
tgt ? tgt : src);
-
+ }
} else if (mnt_context_get_syscall_errno(cxt) == 0) {
/*
* mount(2) syscall success, but something else failed