Mercurial > hg > nginx-quic
comparison src/os/win32/ngx_files.c @ 3137:179f6dfcb7fe
preserve errno while ngx_free()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 16 Sep 2009 13:28:20 +0000 |
parents | 63f71723cd2a |
children | a2479937dbd8 |
comparison
equal
deleted
inserted
replaced
3136:47b7b6ac433e | 3137:179f6dfcb7fe |
---|---|
16 /* FILE_FLAG_BACKUP_SEMANTICS allows to obtain a handle to a directory */ | 16 /* FILE_FLAG_BACKUP_SEMANTICS allows to obtain a handle to a directory */ |
17 | 17 |
18 ngx_fd_t | 18 ngx_fd_t |
19 ngx_open_file(u_char *name, u_long mode, u_long create, u_long access) | 19 ngx_open_file(u_char *name, u_long mode, u_long create, u_long access) |
20 { | 20 { |
21 u_short *u; | 21 u_short *u; |
22 ngx_fd_t fd; | 22 ngx_fd_t fd; |
23 u_short utf16[NGX_UTF16_BUFLEN]; | 23 ngx_err_t err; |
24 u_short utf16[NGX_UTF16_BUFLEN]; | |
24 | 25 |
25 u = ngx_utf8_to_utf16(utf16, name, NGX_UTF16_BUFLEN); | 26 u = ngx_utf8_to_utf16(utf16, name, NGX_UTF16_BUFLEN); |
26 | 27 |
27 if (u == NULL) { | 28 if (u == NULL) { |
28 return INVALID_HANDLE_VALUE; | 29 return INVALID_HANDLE_VALUE; |
31 fd = CreateFileW(u, mode, | 32 fd = CreateFileW(u, mode, |
32 FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, | 33 FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, |
33 NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL); | 34 NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL); |
34 | 35 |
35 if (u != utf16) { | 36 if (u != utf16) { |
37 err = ngx_errno; | |
36 ngx_free(u); | 38 ngx_free(u); |
39 ngx_set_errno(err); | |
37 } | 40 } |
38 | 41 |
39 return fd; | 42 return fd; |
40 } | 43 } |
41 | 44 |