summaryrefslogtreecommitdiffstats
path: root/winsup/utils/mount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/utils/mount.cc')
-rw-r--r--winsup/utils/mount.cc10
1 files changed, 8 insertions, 2 deletions
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;