Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-11-20 22:52:20 +0300
committerIgor Sysoev <igor@sysoev.ru>2004-11-20 22:52:20 +0300
commitd43bee8ee939992404d59ae0fec248ce46abecb0 (patch)
tree6eb79a6902f147bedb8c85350cbdc68543115907 /src/core
parent13376e1538e2b29e436805c626f6837b34a482c5 (diff)
nginx-0.1.8-RELEASE importrelease-0.1.8
*) Bugfix: in the ngx_http_autoindex_module if the long file names were in the listing. *) Feature: the "^~" modifier in the location directive. *) Feature: the proxy_max_temp_file_size directive.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/core/ngx_array.h2
-rw-r--r--src/core/ngx_config.h2
-rw-r--r--src/core/ngx_connection.c2
-rw-r--r--src/core/ngx_crc.h2
-rw-r--r--src/core/ngx_cycle.c46
-rw-r--r--src/core/ngx_file.c152
-rw-r--r--src/core/ngx_file.h42
-rw-r--r--src/core/ngx_garbage_collector.c74
-rw-r--r--src/core/ngx_garbage_collector.h5
-rw-r--r--src/core/ngx_inet.c2
-rw-r--r--src/core/ngx_list.h2
-rw-r--r--src/core/ngx_log.c8
-rw-r--r--src/core/ngx_output_chain.c4
-rw-r--r--src/core/ngx_rbtree.c24
-rw-r--r--src/core/ngx_rbtree.h2
-rw-r--r--src/core/ngx_string.c5
17 files changed, 223 insertions, 153 deletions
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 529c43da5..5f2339b6f 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VER "nginx/0.1.7"
+#define NGINX_VER "nginx/0.1.8"
#define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin"
diff --git a/src/core/ngx_array.h b/src/core/ngx_array.h
index 826395de6..931c7fb50 100644
--- a/src/core/ngx_array.h
+++ b/src/core/ngx_array.h
@@ -26,7 +26,7 @@ void ngx_destroy_array(ngx_array_t *a);
void *ngx_push_array(ngx_array_t *a);
-ngx_inline static ngx_int_t ngx_array_init(ngx_array_t *array, ngx_pool_t *pool,
+static ngx_inline ngx_int_t ngx_array_init(ngx_array_t *array, ngx_pool_t *pool,
ngx_uint_t n, size_t size)
{
if (!(array->elts = ngx_palloc(pool, n * size))) {
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 9faf00a2d..43fd985a2 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -109,7 +109,7 @@ typedef long ngx_flag_t;
/* TODO: auto_conf: ngx_inline inline __inline __inline__ */
#ifndef ngx_inline
-#define ngx_inline inline
+#define ngx_inline __inline
#endif
#define NGX_ACCEPT_THRESHOLD 100
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 06fd85cde..631cd4fa9 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -299,7 +299,7 @@ void ngx_close_listening_sockets(ngx_cycle_t *cycle)
}
}
- if (ngx_close_socket(ls[i].fd) == -1) {
+ if (ngx_close_socket(fd) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
ngx_close_socket_n " %V failed", &ls[i].addr_text);
}
diff --git a/src/core/ngx_crc.h b/src/core/ngx_crc.h
index b78f479e4..73f4cdd67 100644
--- a/src/core/ngx_crc.h
+++ b/src/core/ngx_crc.h
@@ -10,7 +10,7 @@
/* 32-bit crc16 */
-ngx_inline static uint32_t ngx_crc(char *data, size_t len)
+static ngx_inline uint32_t ngx_crc(char *data, size_t len)
{
uint32_t sum;
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 85d945809..d91ba8567 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -49,6 +49,8 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
ngx_list_part_t *part;
ngx_open_file_t *file;
ngx_listening_t *ls, *nls;
+ ngx_core_conf_t *ccf;
+ ngx_event_conf_t *ecf;
ngx_core_module_t *module;
log = old_cycle->log;
@@ -204,6 +206,16 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
if (!failed) {
+ ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx,
+ ngx_core_module);
+
+ if (ngx_create_pathes(cycle, ccf->user) == NGX_ERROR) {
+ failed = 1;
+ }
+ }
+
+
+ if (!failed) {
/* open the new files */
@@ -421,6 +433,13 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
}
}
+
+ ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module);
+
+ ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
+ "using the \"%s\" event method", ecf->name);
+
+
/* close and delete stuff that lefts from an old cycle */
/* close the unneeded listening sockets */
@@ -697,16 +716,6 @@ void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
}
#else
if (user != (ngx_uid_t) -1) {
- if (chown((const char *) file[i].name.data, user, -1) == -1) {
- ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
- "chown \"%s\" failed", file[i].name.data);
-
- if (ngx_close_file(fd) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
- ngx_close_file_n " \"%s\" failed",
- file[i].name.data);
- }
- }
if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
@@ -720,14 +729,27 @@ void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
}
}
+ if (fi.st_uid != user) {
+ if (chown((const char *) file[i].name.data, user, -1) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+ "chown(\"%s\", %d) failed",
+ file[i].name.data, user);
+
+ if (ngx_close_file(fd) == NGX_FILE_ERROR) {
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+ ngx_close_file_n " \"%s\" failed",
+ file[i].name.data);
+ }
+ }
+ }
+
if ((fi.st_mode & (S_IRUSR|S_IWUSR)) != (S_IRUSR|S_IWUSR)) {
fi.st_mode |= (S_IRUSR|S_IWUSR);
if (chmod((const char *) file[i].name.data, fi.st_mode) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
- "chmod \"%s\" failed",
- file[i].name.data);
+ "chmod() \"%s\" failed", file[i].name.data);
if (ngx_close_file(fd) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index 8e1edbd1f..08d9abab5 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -12,9 +12,9 @@ static ngx_uint_t ngx_temp_number;
static ngx_uint_t ngx_random;
-int ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
+ssize_t ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
{
- int rc;
+ ngx_int_t rc;
if (tf->file.fd == NGX_INVALID_FILE) {
rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
@@ -33,16 +33,17 @@ int ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
}
-int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
- ngx_pool_t *pool, int persistent)
+ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
+ ngx_pool_t *pool, int persistent)
{
- int num;
- ngx_err_t err;
+ ngx_err_t err;
+ uint32_t num;
file->name.len = path->name.len + 1 + path->len + 10;
- ngx_test_null(file->name.data, ngx_palloc(pool, file->name.len + 1),
- NGX_ERROR);
+ if (!(file->name.data = ngx_palloc(pool, file->name.len + 1))) {
+ return NGX_ERROR;
+ }
#if 0
for (i = 0; i < file->name.len; i++) {
@@ -52,11 +53,11 @@ int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
ngx_memcpy(file->name.data, path->name.data, path->name.len);
- num = ngx_next_temp_number(0);
+ num = (uint32_t) ngx_next_temp_number(0);
for ( ;; ) {
ngx_sprintf(file->name.data + path->name.len + 1 + path->len,
- "%010ud%Z", num);
+ "%010ui%Z", num);
ngx_create_hashed_filename(file, path);
@@ -85,7 +86,8 @@ int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
#if (NGX_WIN32)
&& err != NGX_ENOTDIR
#endif
- )) {
+ ))
+ {
ngx_log_error(NGX_LOG_CRIT, file->log, err,
ngx_open_tempfile_n " \"%s\" failed",
file->name.data);
@@ -101,8 +103,7 @@ int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path)
{
- int i, name, pos;
- size_t level;
+ ngx_uint_t i, name, pos, level;
name = file->name.len;
pos = path->name.len + 1;
@@ -127,7 +128,7 @@ void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path)
}
-int ngx_create_path(ngx_file_t *file, ngx_path_t *path)
+ngx_int_t ngx_create_path(ngx_file_t *file, ngx_path_t *path)
{
int i, pos;
ngx_err_t err;
@@ -189,32 +190,28 @@ char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
char *p = conf;
- ngx_int_t level;
+ ssize_t level;
ngx_uint_t i, n;
ngx_str_t *value;
- ngx_path_t *path, **pp;
+ ngx_path_t *path, **pp, **slot;
- pp = (ngx_path_t **) (p + cmd->offset);
+ slot = (ngx_path_t **) (p + cmd->offset);
- if (*pp) {
+ if (*slot) {
return "is duplicate";
}
- /* TODO: check duplicate in cf->cycle->pathes */
-
- ngx_test_null(path, ngx_pcalloc(cf->pool, sizeof(ngx_path_t)),
- NGX_CONF_ERROR);
-
- *pp = path;
-
- ngx_test_null(pp, ngx_push_array(&cf->cycle->pathes), NGX_CONF_ERROR);
- *pp = path;
+ if (!(path = ngx_pcalloc(cf->pool, sizeof(ngx_path_t)))) {
+ return NGX_CONF_ERROR;
+ }
- value = (ngx_str_t *) cf->args->elts;
+ value = cf->args->elts;
path->name = value[1];
-
path->len = 0;
+ path->gc_handler = (ngx_gc_handler_pt) cmd->post;
+ path->conf_file = cf->conf_file->file.name.data;
+ path->line = cf->conf_file->line;
for (i = 0, n = 2; n < cf->args->nelts; i++, n++) {
level = ngx_atoi(value[n].data, value[n].len);
@@ -230,7 +227,102 @@ char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
path->level[i++] = 0;
}
- path->gc_handler = (ngx_gc_handler_pt) cmd->post;
+
+ pp = cf->cycle->pathes.elts;
+ for (i = 0; i < cf->cycle->pathes.nelts; i++) {
+ if (pp[i]->name.len == path->name.len
+ && ngx_strcmp(pp[i]->name.data, path->name.data) == 0)
+ {
+ for (n = 0; n < 3; n++) {
+ if (pp[i]->level[n] != path->level[n]) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "the same \"%V\" path name in %s:%ui "
+ "has the different levels than",
+ &pp[i]->name, pp[i]->conf_file, pp[i]->line);
+ return NGX_CONF_ERROR;
+ }
+
+ if (pp[i]->level[n] == 0) {
+ break;
+ }
+ }
+
+ *slot = pp[i];
+
+ return NGX_CONF_OK;
+ }
+ }
+
+ *slot = path;
+
+
+ if (!(pp = ngx_array_push(&cf->cycle->pathes))) {
+ return NGX_CONF_ERROR;
+ }
+
+ *pp = path;
return NGX_CONF_OK;
}
+
+
+ngx_int_t ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
+{
+ ngx_err_t err;
+ ngx_uint_t i;
+ ngx_path_t **path;
+#if !(NGX_WIN32)
+ ngx_file_info_t fi;
+#endif
+
+ path = cycle->pathes.elts;
+ for (i = 0; i < cycle->pathes.nelts; i++) {
+
+ if (ngx_create_dir(path[i]->name.data) == NGX_FILE_ERROR) {
+ err = ngx_errno;
+ if (err != NGX_EEXIST) {
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, err,
+ ngx_create_dir_n " \"%s\" failed",
+ path[i]->name.data);
+ return NGX_ERROR;
+ }
+ }
+
+ if (user == (ngx_uid_t) -1) {
+ continue;
+ }
+
+#if !(NGX_WIN32)
+
+ if (ngx_file_info((const char *) path[i]->name.data, &fi) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+ ngx_file_info_n " \"%s\" failed", path[i]->name.data);
+ return NGX_ERROR;
+ }
+
+ if (fi.st_uid != user) {
+ if (chown((const char *) path[i]->name.data, user, -1) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+ "chown(\"%s\", %d) failed",
+ path[i]->name.data, user);
+ return NGX_ERROR;
+ }
+ }
+
+ if ((fi.st_mode & (S_IRUSR|S_IWUSR|S_IXUSR))
+ != (S_IRUSR|S_IWUSR|S_IXUSR))
+ {
+ fi.st_mode |= (S_IRUSR|S_IWUSR|S_IXUSR);
+
+ if (chmod((const char *) path[i]->name.data, fi.st_mode) == -1) {
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
+ "chmod() \"%s\" failed", path[i]->name.data);
+ return NGX_ERROR;
+ }
+ }
+
+#endif
+ }
+
+ return NGX_OK;
+}
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index d05b6d72a..94fd8c775 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -17,44 +17,48 @@ typedef struct ngx_path_s ngx_path_t;
struct ngx_file_s {
- ngx_fd_t fd;
- ngx_str_t name;
- ngx_file_info_t info;
+ ngx_fd_t fd;
+ ngx_str_t name;
+ ngx_file_info_t info;
- off_t offset;
- off_t sys_offset;
+ off_t offset;
+ off_t sys_offset;
- ngx_log_t *log;
+ ngx_log_t *log;
- ngx_uint_t valid_info:1; /* unsigned valid_info:1; */
+ ngx_uint_t valid_info:1; /* unsigned valid_info:1; */
};
#define NGX_MAX_PATH_LEVEL 3
struct ngx_path_s {
ngx_str_t name;
- u_int len;
- u_int level[3];
+ ngx_uint_t len;
+ ngx_uint_t level[3];
ngx_gc_handler_pt gc_handler;
+
+ u_char *conf_file;
+ ngx_uint_t line;
};
typedef struct {
- ngx_file_t file;
- off_t offset;
- ngx_path_t *path;
- ngx_pool_t *pool;
- char *warn;
+ ngx_file_t file;
+ off_t offset;
+ ngx_path_t *path;
+ ngx_pool_t *pool;
+ char *warn;
- unsigned persistent:1;
+ unsigned persistent:1;
} ngx_temp_file_t;
-int ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain);
-int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
- ngx_pool_t *pool, int persistent);
+ssize_t ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain);
+ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
+ ngx_pool_t *pool, int persistent);
void ngx_create_hashed_filename(ngx_file_t *file, ngx_path_t *path);
-int ngx_create_path(ngx_file_t *file, ngx_path_t *path);
+ngx_int_t ngx_create_path(ngx_file_t *file, ngx_path_t *path);
+ngx_int_t ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user);
void ngx_init_temp_number();
ngx_uint_t ngx_next_temp_number(ngx_uint_t collision);
diff --git a/src/core/ngx_garbage_collector.c b/src/core/ngx_garbage_collector.c
index 73f9cc143..fb6ad772d 100644
--- a/src/core/ngx_garbage_collector.c
+++ b/src/core/ngx_garbage_collector.c
@@ -9,71 +9,8 @@
#include <ngx_garbage_collector.h>
-int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
- ngx_dir_t *dir);
-
-static int ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level);
-
-
-
-#if 0
-
-{
- ngx_test_null(cycle->timer_events,
- ngx_alloc(sizeof(ngx_event_t) * TIMERS, cycle->log),
- NGX_ERROR);
-
- ngx_event_timer_init(cycle);
-}
-
-
-void garbage_collector()
-{
- ngx_msec_t timer;
- struct timeval tv;
- ngx_epoch_msec_t delta;
-
- for ( ;; ) {
- timer = ngx_event_find_timer();
-
- ngx_gettimeofday(&tv);
- delta = tv.tv_sec * 1000 + tv.tv_usec / 1000;
-
- msleep(timer);
-
- ngx_gettimeofday(&tv);
-
- ngx_cached_time = tv.tv_sec;
- ngx_time_update();
-
- delta = tv.tv_sec * 1000 + tv.tv_usec / 1000 - delta;
-
- ngx_event_expire_timers((ngx_msec_t) delta);
- }
-}
-
-#endif
-
-
-void stub_init(ngx_cycle_t *cycle)
-{
- ngx_uint_t i;
- ngx_gc_t ctx;
- ngx_path_t **path;
-
- path = cycle->pathes.elts;
- for (i = 0; i < cycle->pathes.nelts; i++) {
- ctx.path = path[i];
- ctx.log = cycle->log;
- ctx.handler = path[i]->gc_handler;
-
- ngx_collect_garbage(&ctx, &path[i]->name, 0);
- }
-}
-
-
-static int ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level)
+ngx_int_t ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level)
{
int rc;
u_char *last;
@@ -224,7 +161,8 @@ static int ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level)
} else {
ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno,
- "\"%s\" has unknown file type, deleting", fname.data);
+ "the file \"%s\" has unknown type, deleting",
+ fname.data);
if (ngx_delete_file(fname.data) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno,
@@ -249,8 +187,8 @@ static int ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level)
}
-int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
- ngx_dir_t *dir)
+ngx_int_t ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
+ ngx_dir_t *dir)
{
/*
* We use mtime only and do not use atime because:
@@ -264,7 +202,7 @@ int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
}
ngx_log_error(NGX_LOG_NOTICE, ctx->log, 0,
- "delete stale temporary \"%s\"", name->data);
+ "delete the stale temporary file \"%s\"", name->data);
if (ngx_delete_file(name->data) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno,
diff --git a/src/core/ngx_garbage_collector.h b/src/core/ngx_garbage_collector.h
index 72f97604d..cec3a87de 100644
--- a/src/core/ngx_garbage_collector.h
+++ b/src/core/ngx_garbage_collector.h
@@ -23,8 +23,9 @@ struct ngx_gc_s {
};
-int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
- ngx_dir_t *dir);
+ngx_int_t ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level);
+ngx_int_t ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
+ ngx_dir_t *dir);
#endif /* _NGX_GARBAGE_COLLECTOR_H_INCLUDED_ */
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 5cabb49b5..22a5334c6 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -20,7 +20,7 @@
*/
-ngx_inline static size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len)
+static ngx_inline size_t ngx_sprint_uchar(u_char *text, u_char c, size_t len)
{
size_t n;
ngx_uint_t c1, c2;
diff --git a/src/core/ngx_list.h b/src/core/ngx_list.h
index 046bdee16..2dd8ab37a 100644
--- a/src/core/ngx_list.h
+++ b/src/core/ngx_list.h
@@ -30,7 +30,7 @@ typedef struct {
} ngx_list_t;
-ngx_inline static ngx_int_t ngx_list_init(ngx_list_t *list, ngx_pool_t *pool,
+static ngx_inline ngx_int_t ngx_list_init(ngx_list_t *list, ngx_pool_t *pool,
ngx_uint_t n, size_t size)
{
if (!(list->part.elts = ngx_palloc(pool, n * size))) {
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index 521ba7aa3..b7198cd7f 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -155,8 +155,15 @@ static void ngx_log_write(ngx_log_t *log, u_char *errstr, size_t len)
errstr[len++] = CR;
errstr[len++] = LF;
+
WriteFile(log->file->fd, errstr, len, &written, NULL);
+#if 0
+ if (WriteFile(log->file->fd, errstr, len, &written, NULL) == 0) {
+ ngx_message_box("nginx", MB_OK, ngx_errno, "WriteFile() failed");
+ }
+#endif
+
#else
if (len == NGX_MAX_ERROR_STR) {
@@ -164,6 +171,7 @@ static void ngx_log_write(ngx_log_t *log, u_char *errstr, size_t len)
}
errstr[len++] = LF;
+
write(log->file->fd, errstr, len);
#endif
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index 30dda35be..d2fbf12fb 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -12,7 +12,7 @@
#define NGX_NONE 1
-ngx_inline static ngx_int_t
+static ngx_inline ngx_int_t
ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf);
static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src,
ngx_uint_t sendfile);
@@ -188,7 +188,7 @@ ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
}
-ngx_inline static ngx_int_t
+static ngx_inline ngx_int_t
ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
{
if (ngx_buf_special(buf)) {
diff --git a/src/core/ngx_rbtree.c b/src/core/ngx_rbtree.c
index c94db13e8..ef572895a 100644
--- a/src/core/ngx_rbtree.c
+++ b/src/core/ngx_rbtree.c
@@ -20,12 +20,12 @@
#define ngx_rbt_copy_color(n1, n2) (n1->color = n2->color)
-ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_t **root,
- ngx_rbtree_t *sentinel,
- ngx_rbtree_t *node);
-ngx_inline void ngx_rbtree_right_rotate(ngx_rbtree_t **root,
- ngx_rbtree_t *sentinel,
- ngx_rbtree_t *node);
+static ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_t **root,
+ ngx_rbtree_t *sentinel,
+ ngx_rbtree_t *node);
+static ngx_inline void ngx_rbtree_right_rotate(ngx_rbtree_t **root,
+ ngx_rbtree_t *sentinel,
+ ngx_rbtree_t *node);
void ngx_rbtree_insert(ngx_rbtree_t **root, ngx_rbtree_t *sentinel,
@@ -289,9 +289,9 @@ void ngx_rbtree_delete(ngx_rbtree_t **root, ngx_rbtree_t *sentinel,
}
-ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_t **root,
- ngx_rbtree_t *sentinel,
- ngx_rbtree_t *node)
+static ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_t **root,
+ ngx_rbtree_t *sentinel,
+ ngx_rbtree_t *node)
{
ngx_rbtree_t *temp;
@@ -319,9 +319,9 @@ ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_t **root,
}
-ngx_inline void ngx_rbtree_right_rotate(ngx_rbtree_t **root,
- ngx_rbtree_t *sentinel,
- ngx_rbtree_t *node)
+static ngx_inline void ngx_rbtree_right_rotate(ngx_rbtree_t **root,
+ ngx_rbtree_t *sentinel,
+ ngx_rbtree_t *node)
{
ngx_rbtree_t *temp;
diff --git a/src/core/ngx_rbtree.h b/src/core/ngx_rbtree.h
index aa69556f8..d876ec04c 100644
--- a/src/core/ngx_rbtree.h
+++ b/src/core/ngx_rbtree.h
@@ -29,7 +29,7 @@ void ngx_rbtree_delete(ngx_rbtree_t **root, ngx_rbtree_t *sentinel,
ngx_rbtree_t *node);
-ngx_inline static ngx_rbtree_t *ngx_rbtree_min(ngx_rbtree_t *node,
+static ngx_inline ngx_rbtree_t *ngx_rbtree_min(ngx_rbtree_t *node,
ngx_rbtree_t *sentinel)
{
while (node->left != sentinel) {
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
index 94eadfbe2..4e5d273c3 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -135,6 +135,11 @@ u_char *ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
fmt++;
continue;
+ case 'm':
+ width = NGX_INT_T_LEN;
+ fmt++;
+ continue;
+
case 'X':
hexadecimal = 2;
sign = 0;