windows fix

Mon, 04 Aug 2014 12:32:12 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 04 Aug 2014 12:32:12 +0200
changeset 54
fc34bd28a22a
parent 53
ddc4efc9b0f8
child 55
4cb389452a44

windows fix

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Fri Jul 11 12:47:24 2014 +0200
+++ b/dav/sync.c	Mon Aug 04 12:32:12 2014 +0200
@@ -73,6 +73,11 @@
     initGenericErrorDefaultFunc(&fnc);
     ctx = dav_context_new();
     load_config(ctx);
+    
+    // copy proxy config
+    memcpy(ctx->http_proxy, get_http_proxy(), sizeof(Proxy));
+    memcpy(ctx->https_proxy, get_https_proxy(), sizeof(Proxy));
+    
     if(load_sync_config()) {
         return EXIT_FAILURE;
     }
@@ -227,7 +232,7 @@
             }
         }
         
-        if(cdt && s.st_mtim.tv_sec != local->last_modified) {
+        if(cdt && s.st_mtime != local->last_modified) {
             // file modified on the server and on the client
             rename_local_file(dir, db, local->path);
         }
@@ -278,7 +283,7 @@
             }
             // set metadata from stat
             local->etag = etag;
-            local->last_modified = s.st_mtim.tv_sec;
+            local->last_modified = s.st_mtime;
             local->size = s.st_size;
         }
     }
@@ -295,7 +300,7 @@
         return;
     }
     
-    if(s.st_mtim.tv_sec != res->last_modified) {
+    if(s.st_mtime != res->last_modified) {
         free(local_path);
         return;
     }
@@ -436,7 +441,11 @@
         if(!local_dir) {
             fprintf(stderr, "Cannot open directory %s\n", local_path);
         } else {
+#ifdef _WIN32
+            long namemax = 255;
+#else
             long namemax = namemax = pathconf(path, _PC_NAME_MAX);
+#endif
             if(namemax == 0) {
                 namemax = 255;
             }
@@ -540,7 +549,7 @@
             // the file is already in the database
             // compare length and lastmodified date
 
-            if(res->last_modified == s.st_mtim.tv_sec
+            if(res->last_modified == s.st_mtime
                     && res->size == s.st_size)
             {
                 // file unchanged
@@ -548,7 +557,7 @@
             } else {
                 // update db entries
                 res->size = s.st_size;
-                res->last_modified = s.st_mtim.tv_sec;
+                res->last_modified = s.st_mtime;
                 
                 return res;
             }                       
@@ -556,7 +565,7 @@
             LocalResource *res = calloc(1, sizeof(LocalResource));
             res->path = strdup(path);
             res->etag = NULL;
-            res->last_modified = s.st_mtim.tv_sec;
+            res->last_modified = s.st_mtime;
             res->size = s.st_size;
             ucx_map_cstr_put(db->resources, res->path, res);
             return res;

mercurial