LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File mount-new-use-MNT_ERR-for-error-messages.patch of Package util-linux (Project Base:System)

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