comparison src/http/modules/ngx_http_mp4_module.c @ 7754:7a55311b0dc3

Fixed double close of non-regular files in flv and mp4. With introduction of open_file_cache in 1454:f497ed7682a7, opening a file with ngx_open_cached_file() automatically adds a cleanup handler to close the file. As such, calling ngx_close_file() directly for non-regular files is no longer needed and will result in duplicate close() call. In 1454:f497ed7682a7 ngx_close_file() call for non-regular files was removed in the static module, but wasn't in the flv module. And the resulting incorrect code was later copied to the mp4 module. Fix is to remove the ngx_close_file() call from both modules. Reported by Chris Newton.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 11 Dec 2020 13:42:07 +0300
parents f47f7d3d1bfa
children 24f7904dbfa0
comparison
equal deleted inserted replaced
7753:2fec22332ff4 7754:7a55311b0dc3
519 519
520 return rc; 520 return rc;
521 } 521 }
522 522
523 if (!of.is_file) { 523 if (!of.is_file) {
524
525 if (ngx_close_file(of.fd) == NGX_FILE_ERROR) {
526 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
527 ngx_close_file_n " \"%s\" failed", path.data);
528 }
529
530 return NGX_DECLINED; 524 return NGX_DECLINED;
531 } 525 }
532 526
533 r->root_tested = !r->error_page; 527 r->root_tested = !r->error_page;
534 r->allow_ranges = 1; 528 r->allow_ranges = 1;