Mercurial > hg > nginx
comparison src/core/ngx_conf_file.c @ 2302:2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 11 Nov 2008 16:17:45 +0000 |
parents | 7f3e1c63606b |
children | 81d506883bba |
comparison
equal
deleted
inserted
replaced
2301:148c2e840c2b | 2302:2abf14c952a2 |
---|---|
910 | 910 |
911 | 911 |
912 static void | 912 static void |
913 ngx_conf_flush_files(ngx_cycle_t *cycle) | 913 ngx_conf_flush_files(ngx_cycle_t *cycle) |
914 { | 914 { |
915 ssize_t n, len; | |
915 ngx_uint_t i; | 916 ngx_uint_t i; |
916 ngx_list_part_t *part; | 917 ngx_list_part_t *part; |
917 ngx_open_file_t *file; | 918 ngx_open_file_t *file; |
918 | 919 |
919 ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "flush files"); | 920 ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "flush files"); |
930 part = part->next; | 931 part = part->next; |
931 file = part->elts; | 932 file = part->elts; |
932 i = 0; | 933 i = 0; |
933 } | 934 } |
934 | 935 |
935 if (file[i].buffer == NULL || file[i].pos - file[i].buffer == 0) { | 936 len = file[i].pos - file[i].buffer; |
937 | |
938 if (file[i].buffer == NULL || len == 0) { | |
936 continue; | 939 continue; |
937 } | 940 } |
938 | 941 |
939 ngx_write_fd(file[i].fd, file[i].buffer, file[i].pos - file[i].buffer); | 942 n = ngx_write_fd(file[i].fd, file[i].buffer, len); |
943 | |
944 if (n == NGX_FILE_ERROR) { | |
945 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
946 ngx_write_fd_n " to \"%s\" failed", | |
947 file[i].name.data); | |
948 | |
949 } else if (n != len) { | |
950 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, | |
951 ngx_write_fd_n " to \"%s\" was incomplete: %z of %uz", | |
952 file[i].name.data, n, len); | |
953 } | |
940 } | 954 } |
941 } | 955 } |
942 | 956 |
943 | 957 |
944 void ngx_cdecl | 958 void ngx_cdecl |