write -> ngx_write_fd

This commit is contained in:
Roman Arutyunyan 2013-06-11 21:25:59 +04:00
parent b93e2cdff6
commit e9a9c5f4bd

View file

@ -336,7 +336,7 @@ static ngx_int_t
ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s) ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
{ {
static u_char buffer[1024]; static u_char buffer[1024];
int fd; ngx_fd_t fd;
u_char *p; u_char *p;
ngx_rtmp_hls_ctx_t *ctx; ngx_rtmp_hls_ctx_t *ctx;
ssize_t n; ssize_t n;
@ -367,7 +367,8 @@ retry:
} }
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno, ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"hls: open failed: '%V'", &ctx->playlist_bak); "hls: " ngx_open_file_n " failed: '%V'",
&ctx->playlist_bak);
return NGX_ERROR; return NGX_ERROR;
} }
@ -388,10 +389,11 @@ retry:
"#EXT-X-TARGETDURATION:%ui\n", "#EXT-X-TARGETDURATION:%ui\n",
ctx->frag, max_frag); ctx->frag, max_frag);
n = write(fd, buffer, p - buffer); n = ngx_write_fd(fd, buffer, p - buffer);
if (n < 0) { if (n < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno, ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"hls: write failed: '%V'", &ctx->playlist_bak); "hls: " ngx_write_fd_n " failed: '%V'",
&ctx->playlist_bak);
ngx_close_file(fd); ngx_close_file(fd);
return NGX_ERROR; return NGX_ERROR;
} }
@ -413,10 +415,11 @@ retry:
"discont=%i", "discont=%i",
ctx->frag, i + 1, ctx->nfrags, f->duration, f->discont); ctx->frag, i + 1, ctx->nfrags, f->duration, f->discont);
n = write(fd, buffer, p - buffer); n = ngx_write_fd(fd, buffer, p - buffer);
if (n < 0) { if (n < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno, ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"hls: write failed '%V'", &ctx->playlist_bak); "hls: " ngx_write_fd_n " failed '%V'",
&ctx->playlist_bak);
ngx_close_file(fd); ngx_close_file(fd);
return NGX_ERROR; return NGX_ERROR;
} }