--- a/dav/system.c Sat Apr 20 17:47:40 2019 +0200 +++ b/dav/system.c Sat Apr 20 18:46:00 2019 +0200 @@ -32,6 +32,7 @@ #include <dirent.h> #include <sys/stat.h> #include <sys/types.h> +#include <errno.h> #ifndef _WIN32 #include <unistd.h> @@ -111,6 +112,17 @@ return readlink(path, buffer, size); } +int sys_symlink(const char *target, const char *linkpath) { + int err = symlink(target, linkpath); + if(err && errno == EEXIST) { + if(unlink(linkpath)) { + return 1; + } + return sys_symlink(target, linkpath); + } + return err; +} + #else /* ---------- Windows implementation ---------- */ @@ -294,4 +306,10 @@ return 1; } +int sys_symlink(const char *target, const char *linkpath) { + // TODO + fprintf(stderr, "sys_symlink: implement me\n"); + return 1; +} + #endif