nginx-quic/src/os/win32/ngx_files.c

31 lines
567 B
C
Raw Normal View History

2002-09-02 10:48:24 -04:00
2002-12-27 04:27:47 -03:00
#include <ngx_config.h>
2002-09-02 10:48:24 -04:00
#include <ngx_core.h>
2003-06-03 11:42:58 -04:00
2002-09-02 10:48:24 -04:00
ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset)
{
size_t n;
if (ReadFile(file->fd, buf, size, &n, NULL) == 0) {
ngx_log_error(NGX_LOG_ERR, file->log, ngx_errno, "ReadFile() failed");
return NGX_ERROR;
}
2002-12-21 14:14:50 -03:00
file->offset += n;
2002-09-02 10:48:24 -04:00
return n;
}
2003-06-03 11:42:58 -04:00
2003-07-23 16:01:29 -04:00
int ngx_file_append_mode(ngx_fd_t fd)
2003-06-03 11:42:58 -04:00
{
if (SetFilePointer(fd, 0, NULL, FILE_END) == 0xFFFFFFFF) {
if (GetLastError() != NO_ERROR) {
return NGX_ERROR;
}
}
return NGX_OK;
}