aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-03-07 14:16:50 +0100
committerMartin Willi <martin@revosec.ch>2014-06-04 15:53:08 +0200
commit2496eaffdeb855624903950ba844bfdad6361891 (patch)
treeff7f77c27fe3f035a8523047cd844da9fc4a663b
parent8182631bc301d426f76164b8a7a869b0f6285e8d (diff)
downloadstrongswan-2496eaffdeb855624903950ba844bfdad6361891.tar.bz2
strongswan-2496eaffdeb855624903950ba844bfdad6361891.tar.xz
utils: Return plain drive letter as base/pathname for drive letters on Windows
-rw-r--r--src/libstrongswan/utils/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/utils.c b/src/libstrongswan/utils/utils.c
index 1b3765a69..2829aba77 100644
--- a/src/libstrongswan/utils/utils.c
+++ b/src/libstrongswan/utils/utils.c
@@ -241,6 +241,15 @@ char* path_dirname(const char *path)
}
if (!pos)
{
+#ifdef WIN32
+ if (path && strlen(path))
+ {
+ if ((isalpha(path[0]) && path[1] == ':'))
+ { /* if just a drive letter given, return that as dirname */
+ return chunk_clone(chunk_from_chars(path[0], ':', 0)).ptr;
+ }
+ }
+#endif
return strdup(".");
}
while (pos > path && *pos == DIRECTORY_SEPARATOR[0])