]> git.kaiwu.me - nginx.git/commitdiff
uniform ngx_file_info() interface with ngx_fd_info()
authorIgor Sysoev <igor@sysoev.ru>
Wed, 29 Apr 2009 19:28:52 +0000 (19:28 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 29 Apr 2009 19:28:52 +0000 (19:28 +0000)
src/core/ngx_cycle.c
src/core/ngx_file.c
src/core/ngx_open_file_cache.c
src/http/modules/ngx_http_dav_module.c
src/os/win32/ngx_files.c

index 10d07714ba2fa3a213540ee07999ed89899ab499..15f8e8d24b0e0f05c20f8e559197bd737feb3089 100644 (file)
@@ -1126,7 +1126,9 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
         if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) {
             ngx_file_info_t  fi;
 
-            if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) {
+            if (ngx_file_info((const char *) file[i].name.data, &fi)
+                == NGX_FILE_ERROR)
+            {
                 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
                               ngx_file_info_n " \"%s\" failed",
                               file[i].name.data);
index 6bff833d6bec1bc5555a9cf16b5c671fa3a7d214..450da5623f3780b1cc5751092a5041932912894f 100644 (file)
@@ -489,7 +489,9 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
         {
         ngx_file_info_t   fi;
 
-        if (ngx_file_info((const char *) path[i]->name.data, &fi) == -1) {
+        if (ngx_file_info((const char *) path[i]->name.data, &fi)
+            == NGX_FILE_ERROR)
+        {
             ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
                           ngx_file_info_n " \"%s\" failed", path[i]->name.data);
             return NGX_ERROR;
index 6deb0ce0b91051226e23fb33eb9513fa1c70545d..e0b434b13ab8cb145d41e9f3e2cadd0817f6671e 100644 (file)
@@ -143,7 +143,7 @@ ngx_open_cached_file(ngx_open_file_cache_t *cache, ngx_str_t *name,
 
         if (of->test_only) {
 
-            if (ngx_file_info(name->data, &fi) == -1) {
+            if (ngx_file_info(name->data, &fi) == NGX_FILE_ERROR) {
                 of->err = ngx_errno;
                 of->failed = ngx_file_info_n;
                 return NGX_ERROR;
@@ -463,7 +463,7 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log)
 
     if (of->fd != NGX_INVALID_FILE) {
 
-        if (ngx_file_info(name, &fi) == -1) {
+        if (ngx_file_info(name, &fi) == NGX_FILE_ERROR) {
             of->failed = ngx_file_info_n;
             goto failed;
         }
@@ -474,7 +474,7 @@ ngx_open_and_stat_file(u_char *name, ngx_open_file_info_t *of, ngx_log_t *log)
 
     } else if (of->test_dir) {
 
-        if (ngx_file_info(name, &fi) == -1) {
+        if (ngx_file_info(name, &fi) == NGX_FILE_ERROR) {
             of->failed = ngx_file_info_n;
             goto failed;
         }
index f506dde698e3ccd34250ac06e1018547a9d5645d..84a7672a487e98b2a6a4dc681f14ff1cfe7770ec 100644 (file)
@@ -221,7 +221,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
 
     temp = &r->request_body->temp_file->file.name;
 
-    if (ngx_file_info(path.data, &fi) == -1) {
+    if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
         status = NGX_HTTP_CREATED;
 
     } else {
@@ -326,7 +326,7 @@ ok:
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http delete filename: \"%s\"", path.data);
 
-    if (ngx_file_info(path.data, &fi) == -1) {
+    if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
         err = ngx_errno;
 
         rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
@@ -678,7 +678,7 @@ overwrite_done:
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "http copy to: \"%s\"", copy.path.data);
 
-    if (ngx_file_info(copy.path.data, &fi) == -1) {
+    if (ngx_file_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
         err = ngx_errno;
 
         if (err != NGX_ENOENT) {
@@ -712,7 +712,7 @@ overwrite_done:
         dir = ngx_is_dir(&fi);
     }
 
-    if (ngx_file_info(path.data, &fi) == -1) {
+    if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
         return ngx_http_dav_error(r->connection->log, ngx_errno,
                                   NGX_HTTP_NOT_FOUND, ngx_file_info_n,
                                   path.data);
index e10bce3aebb3f39af97e52d6cb3b2ab09a24180c..4397b28a08d8b2593958147bb65aba03742a632e 100644 (file)
@@ -311,7 +311,7 @@ ngx_file_info(u_char *file, ngx_file_info_t *sb)
     /* NT4 and Win98 */
 
     if (GetFileAttributesEx((char *) file, GetFileExInfoStandard, &fa) == 0) {
-        return NGX_ERROR;
+        return NGX_FILE_ERROR;
     }
 
     sb->dwFileAttributes = fa.dwFileAttributes;
@@ -321,7 +321,7 @@ ngx_file_info(u_char *file, ngx_file_info_t *sb)
     sb->nFileSizeHigh = fa.nFileSizeHigh;
     sb->nFileSizeLow = fa.nFileSizeLow;
 
-    return NGX_OK;
+    return ~NGX_FILE_ERROR;
 }