Skip to content

Commit

Permalink
windows: return NULL in xreadlink
Browse files Browse the repository at this point in the history
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 <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
Alin Serdean authored and blp committed Apr 15, 2017
1 parent edddf95 commit f984769
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/util.c
Expand Up @@ -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) {
Expand All @@ -998,6 +1002,7 @@ xreadlink(const char *filename)
return NULL;
}
}
#endif
}

/* Returns a version of 'filename' with symlinks in the final component
Expand Down

0 comments on commit f984769

Please sign in to comment.