[ovs-dev] Windows: Report absolute file name

Alin Serdean aserdean at cloudbasesolutions.com
Fri Aug 12 07:39:01 UTC 2016


On Windows if a file path contains ":" we can safely say it is an absolute
file name.

This patch allows file_name checks to report correctly when using
"abs_file_name".

Found by testing.

Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
 lib/util.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/util.c b/lib/util.c
index 241a7f1..689a9de 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -926,6 +926,10 @@ abs_file_name(const char *dir, const char *file_name)
 {
     if (file_name[0] == '/') {
         return xstrdup(file_name);
+#ifdef _WIN32
+    } else if (strchr(file_name, ':')) {
+        return xstrdup(file_name);
+#endif
     } else if (dir && dir[0]) {
         char *separator = dir[strlen(dir) - 1] == '/' ? "" : "/";
         return xasprintf("%s%s%s", dir, separator, file_name);
-- 
2.9.2.windows.1



More information about the dev mailing list