readlink does not exist on Windows.

While we could skip the function all togheter on Windows, we may add
support for it later on. For the moment return change errno to ENOENT
and return NULL.

FYI:
https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/#kBeZetM7P1dorllZ.97
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365680(v=vs.85).aspx

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

diff --git a/lib/util.c b/lib/util.c
index 1c06ce0..5660ab5 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -980,6 +980,10 @@ abs_file_name(const char *dir, const char *file_name)
 static char *
 xreadlink(const char *filename)
 {
+#ifdef _WIN32
+        errno = ENOENT;
+        return NULL;
+#else
     size_t size;
 
     for (size = 64; ; size *= 2) {
@@ -998,6 +1002,7 @@ xreadlink(const char *filename)
             return NULL;
         }
     }
+#endif
 }
 
 /* Returns a version of 'filename' with symlinks in the final component
-- 
2.10.2.windows.1
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to