I've found a bug in util-linux-ng-2.13. Fixed in the stable branch by
the patch below.
Karel
>From 031a4a7ab1b8ebab2f88f41bc98965855dbd1c62 Mon Sep 17 00:00:00 2001
From: Karel Zak <[EMAIL PROTECTED]>
Date: Thu, 11 Oct 2007 16:18:29 +0200
Subject: [PATCH] mount: -L|-U segfault when label or uuid doesn't exist
# mount -L foo
Segmentation fault
mount(8) calls strcmp() with NULL argument.
Signed-off-by: Karel Zak <[EMAIL PROTECTED]>
---
mount/mount.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/mount/mount.c b/mount/mount.c
index 2e458ca..b65ee62 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1702,6 +1702,9 @@ getfs(const char *spec, const char *uuid, const char
*label)
struct mntentchn *mc = NULL;
const char *devname = NULL;
+ if (!spec && !uuid && !label)
+ return NULL;
+
/*
* A) 99% of all cases, the spec on cmdline matches
* with spec in fstab
@@ -1764,7 +1767,7 @@ getfs(const char *spec, const char *uuid, const char
*label)
* Earlier mtab was tried first, but this would sometimes try the
* wrong mount in case mtab had the root device entry wrong.
*/
- if (!mc)
+ if (!mc && (devname || spec))
mc = getmntfile (devname ? devname : spec);
if (devname)
@@ -1984,12 +1987,17 @@ main(int argc, char *argv[]) {
case 1:
/* mount [-nfrvw] [-o options] special | node
+ * mount -L label (or -U uuid)
* (/etc/fstab is necessary)
*/
if (types != NULL)
usage (stderr, EX_USAGE);
- mc = getfs(*argv, uuid, label);
+ if (uuid || label)
+ mc = getfs(NULL, uuid, label);
+ else
+ mc = getfs(*argv, NULL, NULL);
+
if (!mc) {
if (uuid || label)
die (EX_USAGE, _("mount: no such partition
found"));
--
1.5.3.1
--
Karel Zak <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html