diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 9ebc5f802..696b194ab 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 464240f75..fd2d6c539 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;