Hi
I read the code in src/os/ngx_files.c, function ngx_write_file, but
get a little confused
* for ( ;; ) {
n = pwrite(file->fd, buf, size, offset);
if (n == -1) {
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
"pwrite() \"%s\" failed", file->name.data);
return NGX_ERROR;
}
file->offset += n;
written += n;
if ((size_t) n == size) {
return written;
}
offset += n;
size -= n;
}
* the code seems want to write all content in buf to file(file->fd), but
I think *n = pwrite(file->fd, buf, size, offset) *should be changed to* **n
= pwrite(file->fd, buf+written, size, offset);
man pwrite:
**pwrite() writes up to count bytes from the buffer starting at buf
to the file descriptor fd at offset offset. The file offset is not
changed.**
*
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel