dav/main.c

changeset 32
c9d37bb97ea8
parent 31
59cdf7b7316f
child 33
0bbbb0341606
--- a/dav/main.c	Thu Aug 22 14:27:58 2013 +0200
+++ b/dav/main.c	Fri Aug 23 11:04:07 2013 +0200
@@ -34,7 +34,6 @@
 #include <time.h>
 #include <libxml/xmlerror.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <ucx/string.h>
 #include <dirent.h>
 
@@ -280,8 +279,13 @@
     struct tm t;
     struct tm n;
     time_t now = time(NULL);
+#ifdef _WIN32
+    memcpy(&t, localtime(&tm), sizeof(struct tm));
+    memcpy(&n, localtime(&now), sizeof(struct tm));
+#else
     localtime_r(&tm, &t);
     localtime_r(&now, &n);
+#endif /* _WIN32 */
     char *str = malloc(16);
     if(t.tm_year == n.tm_year) {
         strftime(str, 16, "%b %d %H:%M", &t);
@@ -521,7 +525,7 @@
         // create directory
         if(outlen != 0) {
             mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
-            int ret = mkdir(out, mode);
+            int ret = util_mkdir(out, mode);
             if(ret != 0 && errno != EEXIST) {
                 return 1;
             }

mercurial