Commit Graph

138 Commits

Author SHA1 Message Date
Valentin Bartenev
604e18fb2c Use NGX_FILE_ERROR for handling file operations errors.
On Win32 platforms 0 is used to indicate errors in file operations, so
comparing against -1 is not portable.

This was not much of an issue in patched code, since only ngx_fd_info() test
is actually reachable on Win32 and in worst case it might result in bogus
error log entry.

Patch by Piotr Sikora.
2013-03-25 15:49:11 +00:00
Valentin Bartenev
ff2e304223 The data pointer in ngx_open_file_t objects must be initialized.
Uninitialized pointer may result in arbitrary segfaults if access_log is used
without buffer and without variables in file path.

Patch by Tatsuhiko Kubo (ticket #268).
2013-01-08 14:01:57 +00:00
Valentin Bartenev
a8ffed5751 Reopening log files code moved to a separate function.
The code refactored in a way to call custom handler that can do appropriate
cleanup work (if any), like flushing buffers, finishing compress streams,
finalizing connections to log daemon, etc..
2012-12-23 15:36:52 +00:00
Valentin Bartenev
fac3b341da Fixed handling of ngx_write_fd() and ngx_read_fd() errors.
The ngx_write_fd() and ngx_read_fd() functions return -1 in case of error,
so the incorrect comparison with NGX_FILE_ERROR (which is 0 on windows
platforms) might result in inaccurate error message in the error log.

Also the ngx_errno global variable is being set only if the returned value
is -1.
2012-12-14 15:24:24 +00:00
Ruslan Ermilov
da4ffd8955 Fixed the "include" directive.
The "include" directive should be able to include multiple files if
given a filename mask.  Fixed this to work for "include" directives
inside the "map" or "types" blocks.  The "include" directive inside
the "geo" block is still not fixed.
2012-08-28 13:31:01 +00:00
Ruslan Ermilov
1c31039d1e Improved diagnostics when a directive is specified in the wrong context. 2012-07-29 19:59:06 +00:00
Ruslan Ermilov
1efcca36cc Fixed compilation with -Wmissing-prototypes. 2012-07-24 15:09:54 +00:00
Ruslan Ermilov
e9a7f4f5f6 Don't silently ignore the last line of configuration file that
consists solely of one unterminated token (inspired by #150).
2012-04-18 13:30:43 +00:00
Ruslan Ermilov
43d2b1c045 Fixed grammar in error messages. 2012-04-12 19:35:41 +00:00
Maxim Dounin
9f38b20db5 Time parsing cleanup.
Nuke NGX_PARSE_LARGE_TIME, it's not used since 0.6.30.  The only error
ngx_parse_time() can currently return is NGX_ERROR, check it explicitly
and make sure to cast it to appropriate type (either time_t or ngx_msec_t)
to avoid signedness warnings on platforms with unsigned time_t (notably QNX).
2012-02-13 15:41:11 +00:00
Maxim Konovalov
f8d59e33f3 Copyright updated. 2012-01-18 15:07:43 +00:00
Igor Sysoev
d63104eea4 use memmove() in appropriate places 2011-04-12 08:02:46 +00:00
Igor Sysoev
aa6936e61a style fix 2010-06-23 16:34:54 +00:00
Igor Sysoev
05b1a8f1e3 ngx_str_set() and ngx_str_null() 2010-05-14 09:56:37 +00:00
Igor Sysoev
b87fba807e const char *fmt in ngx_conf_log_error() 2010-02-12 09:45:05 +00:00
Igor Sysoev
21accae8e5 cf->conf_file->file.name.data may be uninitialized, if an allocation failed;
found by Clang Static Analyzer
2009-11-05 17:10:48 +00:00
Igor Sysoev
f0a827adcb add drive letter for Win32 root path 2009-06-02 14:00:01 +00:00
Igor Sysoev
731e6a9b11 style fix 2009-05-14 16:24:39 +00:00
Igor Sysoev
0cd76ea290 *) refactor error_log processing: listen socket log might inherit built-in
error_log with zero level, and r2447, r2466, r2467 were not enough
*) remove bogus "stderr" level
*) some functions and fields renames
2009-04-30 13:53:42 +00:00
Igor Sysoev
ca6a9e0fdc *) do not show line number for -g option
*) reset configuration file after -g option has been parsed
2009-04-28 20:06:03 +00:00
Igor Sysoev
f67e0a4050 ngx_log_errno() 2009-04-27 13:17:33 +00:00
Igor Sysoev
e1c9746e37 use ngx_vslprintf(), ngx_slprintf() 2009-04-27 13:06:20 +00:00
Igor Sysoev
5ef370df40 -p and --prefix= 2009-04-27 11:32:33 +00:00
Igor Sysoev
c28ff717cb issue start up errors and warning on both stderr and error_log 2009-04-23 11:13:12 +00:00
Igor Sysoev
1f4220ee86 small optimization: " == NGX_ERROR" > " != NGX_OK" 2009-02-24 10:42:23 +00:00
Igor Sysoev
8ab0867644 allocate cf->conf_file and cf->conf_file->buffer on stack 2008-11-25 15:55:10 +00:00
Igor Sysoev
2a523f1c71 fix segfault on close error 2008-11-25 14:45:44 +00:00
Igor Sysoev
ecbb69ad7f *) increase ngx_conf_log_error() buffer
*) always log an error code
2008-11-25 13:00:53 +00:00
Igor Sysoev
f2884e194a compatibility with glibc 2.3, warn_unused_result attribute for write() 2008-11-11 16:17:45 +00:00
Igor Sysoev
cf0c445a14 fix building by msvc introduced in r2223 2008-09-01 15:17:54 +00:00
Igor Sysoev
63c78f3c34 test conf file size, this fixes OpenBSD's "nginx -c /tmp/" bug 2008-09-01 13:59:11 +00:00
Igor Sysoev
c48f49f837 quoted too long parameter error 2008-08-27 12:19:07 +00:00
Igor Sysoev
6d09950cd8 too long parameter error 2008-08-26 21:10:20 +00:00
Igor Sysoev
a6e337fdef fix types 2008-08-26 21:04:06 +00:00
Igor Sysoev
b4fbdcf5d4 -g switch 2008-06-30 12:35:16 +00:00
Igor Sysoev
eb03ea7458 refactor obscure code 2008-06-25 14:56:14 +00:00
Igor Sysoev
7f6b2ffc60 *) back out r2040
*) refactor ngx_palloc()
*) introduce ngx_pnalloc()
*) additional pool blocks have smaller header
2008-06-17 15:00:30 +00:00
Igor Sysoev
a13b3b97ea ignore glob no match error 2008-04-29 09:28:42 +00:00
Igor Sysoev
85d6a3e3db included file name must be allocated in pool,
because it may be used in error message later
2008-03-03 17:12:05 +00:00
Igor Sysoev
cb54061885 *) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
this fixes fastcgi_catch_stderr segfault introduced in r1453
*) ngx_http_upstream_hide_headers_hash()
*) proxy/fastcgi pass_header/hide_header use
   ngx_http_upstream_hide_headers_hash()
2007-12-09 18:03:20 +00:00
Igor Sysoev
bfb23bf604 style fix: remove double semicolons 2007-10-09 20:11:03 +00:00
Igor Sysoev
e7e7dedfb3 fix typo 2007-08-31 06:15:50 +00:00
Igor Sysoev
a1df416d65 --sysconfdir=DIR 2007-07-29 18:05:45 +00:00
Igor Sysoev
1849ba824e change wording 2007-06-05 11:55:39 +00:00
Igor Sysoev
40460bab8d ngx_log_error() > ngx_conf_log_error() 2007-02-20 15:47:54 +00:00
Igor Sysoev
bb4c112fe5 use "goto" instead of indistinct "break" 2007-02-20 14:36:48 +00:00
Igor Sysoev
83fe66212f stop on superfluous closing "}" 2007-02-20 14:33:26 +00:00
Igor Sysoev
722231f407 ngx_strcasecmp()/ngx_strncasecmp() 2007-02-14 18:51:19 +00:00
Igor Sysoev
50034b856c ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access) 2007-01-18 20:15:09 +00:00
Igor Sysoev
dd15b55fbc style fix 2007-01-07 22:44:56 +00:00