From bcea2252572bfecd002500cc8d0e2f3fd807ebdd Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 25 May 2007 12:28:49 +0200 Subject: [PATCH] mount: parse SPEC before search in fstab The mount blindly uses a SPEC from command line and tries to found the SPEC in /etc/fstab. It's better to parse the SPEC and search by UUID, LABEL or devname only. Signed-off-by: Karel Zak --- mount/fstab.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mount/fstab.c b/mount/fstab.c index ec5a9655..b7792bc0 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -369,6 +369,24 @@ getfs_by_dir (const char *dir) { /* Find the device SPEC in fstab. */ struct mntentchn * getfs_by_spec (const char *spec) { + char *name, *value; + struct mntentchn *mc = NULL; + + if (!spec) + return NULL; + + if (parse_spec(spec, &name, &value) != 0) + return NULL; /* parse error */ + + if (name) { + if (!strcmp(name,"LABEL")) + mc = getfs_by_label (value); + else if (!strcmp(name,"UUID")) + mc = getfs_by_uuid (value); + + free((void *) name); + return mc; + } return getfs_by_devname(spec); } -- 2.39.5