Mercurial > hg > nginx
comparison src/core/ngx_cycle.c @ 5680:dfb3c15bc851
Core: fixed error handling in ngx_reopen_files().
Found by Coverity (CID 1087509).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 30 Apr 2014 19:16:40 +0400 |
parents | b2b5b1b74129 |
children | 457ec43dd8d5 |
comparison
equal
deleted
inserted
replaced
5679:5748ce74c1cc | 5680:dfb3c15bc851 |
---|---|
1102 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | 1102 if (ngx_close_file(fd) == NGX_FILE_ERROR) { |
1103 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 1103 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
1104 ngx_close_file_n " \"%s\" failed", | 1104 ngx_close_file_n " \"%s\" failed", |
1105 file[i].name.data); | 1105 file[i].name.data); |
1106 } | 1106 } |
1107 | |
1108 continue; | |
1107 } | 1109 } |
1108 | 1110 |
1109 if (fi.st_uid != user) { | 1111 if (fi.st_uid != user) { |
1110 if (chown((const char *) file[i].name.data, user, -1) == -1) { | 1112 if (chown((const char *) file[i].name.data, user, -1) == -1) { |
1111 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 1113 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
1115 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | 1117 if (ngx_close_file(fd) == NGX_FILE_ERROR) { |
1116 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 1118 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
1117 ngx_close_file_n " \"%s\" failed", | 1119 ngx_close_file_n " \"%s\" failed", |
1118 file[i].name.data); | 1120 file[i].name.data); |
1119 } | 1121 } |
1122 | |
1123 continue; | |
1120 } | 1124 } |
1121 } | 1125 } |
1122 | 1126 |
1123 if ((fi.st_mode & (S_IRUSR|S_IWUSR)) != (S_IRUSR|S_IWUSR)) { | 1127 if ((fi.st_mode & (S_IRUSR|S_IWUSR)) != (S_IRUSR|S_IWUSR)) { |
1124 | 1128 |
1131 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | 1135 if (ngx_close_file(fd) == NGX_FILE_ERROR) { |
1132 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 1136 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
1133 ngx_close_file_n " \"%s\" failed", | 1137 ngx_close_file_n " \"%s\" failed", |
1134 file[i].name.data); | 1138 file[i].name.data); |
1135 } | 1139 } |
1140 | |
1141 continue; | |
1136 } | 1142 } |
1137 } | 1143 } |
1138 } | 1144 } |
1139 | 1145 |
1140 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { | 1146 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { |