Kouhei Sutou
null+****@clear*****
Thu May 21 16:03:53 JST 2015
Kouhei Sutou 2015-05-21 16:03:53 +0900 (Thu, 21 May 2015) New Revision: 98db729fdfef7d8ee7afc2454bd3aee3a4998300 https://github.com/groonga/groonga/commit/98db729fdfef7d8ee7afc2454bd3aee3a4998300 Message: Fix a build error on OpenBSD cc1: warnings being treated as errors /home/vagrant/groonga-5.0.3.2015.05.21/src/httpd/nginx-module/ngx_http_groonga_module.c: In function 'ngx_http_groonga_logger_log': /home/vagrant/groonga-5.0.3.2015.05.21/src/httpd/nginx-module/ngx_http_groonga_module.c:174: warning: passing argument 2 of 'ngx_write_fd' discards qualifiers from pointer target type /home/vagrant/groonga-5.0.3.2015.05.21/src/httpd/nginx-module/ngx_http_groonga_module.c:177: warning: passing argument 2 of 'ngx_write_fd' discards qualifiers from pointer target type [groonga-dev,03255] Reported by HAYASHI Kentaro. Thanks!!! Modified files: src/httpd/nginx-module/ngx_http_groonga_module.c Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+28 -2) =================================================================== --- src/httpd/nginx-module/ngx_http_groonga_module.c 2015-05-21 00:22:08 +0900 (6ba1df4) +++ src/httpd/nginx-module/ngx_http_groonga_module.c 2015-05-21 16:03:53 +0900 (1879fa6) @@ -134,6 +134,28 @@ ngx_str_is_custom_path(ngx_str_t *string) } static void +ngx_http_groonga_write_fd(int fd, + u_char *buffer, size_t buffer_size, + const char *message, size_t message_size) +{ + size_t rest_message_size = message_size; + + while (rest_message_size > 0) { + size_t current_message_size; + + if (rest_message_size > NGX_MAX_ERROR_STR) { + current_message_size = NGX_MAX_ERROR_STR; + } else { + current_message_size = rest_message_size; + } + + grn_memcpy(buffer, message, current_message_size); + rest_message_size -= current_message_size; + ngx_write_fd(fd, buffer, current_message_size); + } +} + +static void ngx_http_groonga_logger_log(grn_ctx *ctx, grn_log_level level, const char *timestamp, const char *title, const char *message, const char *location, @@ -171,10 +193,14 @@ ngx_http_groonga_logger_log(grn_ctx *ctx, grn_log_level level, LOG_PREFIX_FORMAT, timestamp, *(level_marks + level), title); ngx_write_fd(logger_data->file->fd, buffer, last - buffer); - ngx_write_fd(logger_data->file->fd, (void *)message, message_size); + ngx_http_groonga_write_fd(logger_data->file->fd, + buffer, NGX_MAX_ERROR_STR, + message, message_size); if (location_size > 0) { ngx_write_fd(logger_data->file->fd, " ", 1); - ngx_write_fd(logger_data->file->fd, (void *)location, location_size); + ngx_http_groonga_write_fd(logger_data->file->fd, + buffer, NGX_MAX_ERROR_STR, + location, location_size); } ngx_write_fd(logger_data->file->fd, "\n", 1); } else { -------------- next part -------------- HTML����������������������������...Download