Mercurial > hg > nginx
comparison src/core/ngx_cycle.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 | bf38420c9e25 |
children | 6fd7d9c3218d |
comparison
equal
deleted
inserted
replaced
2301:148c2e840c2b | 2302:2abf14c952a2 |
---|---|
994 | 994 |
995 | 995 |
996 void | 996 void |
997 ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user) | 997 ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user) |
998 { | 998 { |
999 ssize_t n, len; | |
999 ngx_fd_t fd; | 1000 ngx_fd_t fd; |
1000 ngx_uint_t i; | 1001 ngx_uint_t i; |
1001 ngx_list_part_t *part; | 1002 ngx_list_part_t *part; |
1002 ngx_open_file_t *file; | 1003 ngx_open_file_t *file; |
1003 | 1004 |
1017 | 1018 |
1018 if (file[i].name.data == NULL) { | 1019 if (file[i].name.data == NULL) { |
1019 continue; | 1020 continue; |
1020 } | 1021 } |
1021 | 1022 |
1022 if (file[i].buffer && file[i].pos - file[i].buffer != 0) { | 1023 len = file[i].pos - file[i].buffer; |
1023 ngx_write_fd(file[i].fd, file[i].buffer, | 1024 |
1024 file[i].pos - file[i].buffer); | 1025 if (file[i].buffer && len != 0) { |
1026 | |
1027 n = ngx_write_fd(file[i].fd, file[i].buffer, len); | |
1028 | |
1029 if (n == NGX_FILE_ERROR) { | |
1030 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | |
1031 ngx_write_fd_n " to \"%s\" failed", | |
1032 file[i].name.data); | |
1033 | |
1034 } else if (n != len) { | |
1035 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, | |
1036 ngx_write_fd_n " to \"%s\" was incomplete: %z of %uz", | |
1037 file[i].name.data, n, len); | |
1038 } | |
1039 | |
1025 file[i].pos = file[i].buffer; | 1040 file[i].pos = file[i].buffer; |
1026 } | 1041 } |
1027 | 1042 |
1028 fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR, | 1043 fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR, |
1029 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND, | 1044 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND, |