# HG changeset patch # User Olaf Wintermann # Date 1532010517 -7200 # Node ID 68a786fa4695d65df7bc2d6edef0b348709a1bba # Parent e48af5bfb6370296bedeffd7e2b4ab708a6c71c4 fixes wrong buffer allocation on windows diff -r e48af5bfb637 -r 68a786fa4695 dav/sync.c --- a/dav/sync.c Wed Jul 11 15:46:15 2018 +0200 +++ b/dav/sync.c Thu Jul 19 16:28:37 2018 +0200 @@ -1255,7 +1255,7 @@ } char *new_path = util_concat_path(p, ent->name); - int isdir; + int isdir = 0; LocalResource *res = local_resource_new(dir, db, new_path, &isdir); if(isdir) { resources = ucx_list_append(resources, res); diff -r e48af5bfb637 -r 68a786fa4695 dav/system.c --- a/dav/system.c Wed Jul 11 15:46:15 2018 +0200 +++ b/dav/system.c Thu Jul 19 16:28:37 2018 +0200 @@ -100,7 +100,11 @@ } int sys_mkdir(const char *path) { +#ifdef _WIN32 + return mkdir(path); +#else return mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); +#endif } #else @@ -111,7 +115,7 @@ size_t lenadd = dir ? 2 : 0; - wchar_t *wpath = calloc(len+lenadd, sizeof(wchar_t)); + wchar_t *wpath = calloc(len+lenadd+1, sizeof(wchar_t)); int wlen = MultiByteToWideChar( CP_UTF8, 0, diff -r e48af5bfb637 -r 68a786fa4695 dav/system.h --- a/dav/system.h Wed Jul 11 15:46:15 2018 +0200 +++ b/dav/system.h Thu Jul 19 16:28:37 2018 +0200 @@ -54,6 +54,10 @@ WIN32_FIND_DATAW finddata; SysDirEnt *ent; }; +typedef struct SysDir { + DIR *dir; + SysDirEnt *ent; +} SysDir; #define SYS_DIR struct WinDir* #define SYS_STAT struct __stat64