From 04f9f7c58e358c9a0e6a9630b4add0f0ed6a3b1c Mon Sep 17 00:00:00 2001 From: corinna Date: Mon, 2 Mar 2009 10:47:03 +0000 Subject: [PATCH] * mount.cc (mount_entries): Handle a "/" cygdrive prefix correctly. Add comments. --- winsup/utils/ChangeLog | 5 +++++ winsup/utils/mount.cc | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 9ebc5f8022..696b194ab4 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,8 @@ +2009-03-02 Corinna Vinschen + + * mount.cc (mount_entries): Handle a "/" cygdrive prefix correctly. + Add comments. + 2009-02-23 Sjors Gielen * Makefile.in: Add DESTDIR functionality. diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc index 464240f750..fd2d6c5393 100644 --- a/winsup/utils/mount.cc +++ b/winsup/utils/mount.cc @@ -386,9 +386,15 @@ mount_entries (void) char opts[strlen (p->mnt_opts) + 1]; convert_spaces (dirname, p->mnt_dir); + // remove trailing slash char *ls = strrchr (dirname, '/'); - if (ls && ls > dirname) - *ls = '\0'; + if (ls) + { + // last slash == leading slash? cygdrive prefix == "/" + if (ls == dirname) + ++ls; + *ls = '\0'; + } *stpncpy (opts, p->mnt_opts, noumount - p->mnt_opts) = '\0'; printf (format_cyg, dirname, opts); break; -- 2.11.0