Commit 509d12ae authored by Max Kellermann's avatar Max Kellermann

utils: implement parsePath() with g_strdup() on WIN32

On WIN32, parsePath() now simply duplicates the input string. There is currently nothing special we can do here. The old code was not portable on WIN32.
parent d4638834
...@@ -21,12 +21,16 @@ ...@@ -21,12 +21,16 @@
#include "../config.h" #include "../config.h"
#include <glib.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <pwd.h>
#include <fcntl.h> #include <fcntl.h>
#include <glib.h>
#ifndef WIN32
#include <pwd.h>
#endif
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
#include <sys/socket.h> #include <sys/socket.h>
...@@ -114,6 +118,7 @@ G_GNUC_MALLOC void *xcalloc(size_t nmemb, size_t size) ...@@ -114,6 +118,7 @@ G_GNUC_MALLOC void *xcalloc(size_t nmemb, size_t size)
char *parsePath(char *path) char *parsePath(char *path)
{ {
#ifndef WIN32
if (path[0] != '/' && path[0] != '~') { if (path[0] != '/' && path[0] != '~') {
g_warning("\"%s\" is not an absolute path", path); g_warning("\"%s\" is not an absolute path", path);
return NULL; return NULL;
...@@ -170,8 +175,11 @@ char *parsePath(char *path) ...@@ -170,8 +175,11 @@ char *parsePath(char *path)
strcat(newPath, path + pos); strcat(newPath, path + pos);
return newPath; return newPath;
} else { } else {
#endif
return xstrdup(path); return xstrdup(path);
#ifndef WIN32
} }
#endif
} }
int set_nonblocking(int fd) int set_nonblocking(int fd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment