]> git.kaiwu.me - nginx.git/commitdiff
merge r3482:
authorIgor Sysoev <igor@sysoev.ru>
Mon, 7 Jun 2010 11:48:19 +0000 (11:48 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 7 Jun 2010 11:48:19 +0000 (11:48 +0000)
do not set file time in ngx_copy_file() if the time is -1,
this fixes an issue when file is moved across devices

src/core/ngx_file.c

index 6844849ad3120c6e40fba367c7e2209c7e64fb9f..b5160f3ea44fb6f482f0b0af8fb22e211c8e399c 100644 (file)
@@ -762,10 +762,12 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
         size -= n;
     }
 
-    if (ngx_set_file_time(to, nfd, cf->time) != NGX_OK) {
-        ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
-                      ngx_set_file_time_n " \"%s\" failed", to);
-        goto failed;
+    if (cf->time != -1) {
+        if (ngx_set_file_time(to, nfd, cf->time) != NGX_OK) {
+            ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
+                          ngx_set_file_time_n " \"%s\" failed", to);
+            goto failed;
+        }
     }
 
     rc = NGX_OK;