projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*** empty log message ***
[gnulib.git]
/
lib
/
dirname.c
diff --git
a/lib/dirname.c
b/lib/dirname.c
index
483c338
..
cf62de7
100644
(file)
--- a/
lib/dirname.c
+++ b/
lib/dirname.c
@@
-57,8
+57,17
@@
dir_name (const char *path)
else
{
/* Remove any trailing slashes from the result. */
else
{
/* Remove any trailing slashes from the result. */
+#ifdef MSDOS
+ char *lim = (path[0] >= 'A' && path[0] <= 'z' && path[1] == ':')
+ ? path + 2 : path;
+
+ /* If canonicalized "d:/path", leave alone the root case "d:/". */
+ while (slash > lim && *slash == '/')
+ --slash;
+#else
while (slash > path && *slash == '/')
--slash;
while (slash > path && *slash == '/')
--slash;
+#endif
length = slash - path + 1;
}
length = slash - path + 1;
}