Mercurial > hg > nginx-quic
comparison src/os/win32/ngx_files.c @ 9038:7d60e4584d9e
Win32: non-ASCII directory names support in ngx_delete_dir().
This makes it possible to delete directories with non-ASCII characters
when using the dav module (ticket #1433).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 23 Feb 2023 20:49:47 +0300 |
parents | e0f385521c79 |
children | 8880fe0b193c |
comparison
equal
deleted
inserted
replaced
9037:e0f385521c79 | 9038:7d60e4584d9e |
---|---|
598 if (ngx_win32_check_filename(u, len, 1) != NGX_OK) { | 598 if (ngx_win32_check_filename(u, len, 1) != NGX_OK) { |
599 goto failed; | 599 goto failed; |
600 } | 600 } |
601 | 601 |
602 rc = CreateDirectoryW(u, NULL); | 602 rc = CreateDirectoryW(u, NULL); |
603 | |
604 failed: | |
605 | |
606 if (u != utf16) { | |
607 err = ngx_errno; | |
608 ngx_free(u); | |
609 ngx_set_errno(err); | |
610 } | |
611 | |
612 return rc; | |
613 } | |
614 | |
615 | |
616 ngx_int_t | |
617 ngx_delete_dir(u_char *name) | |
618 { | |
619 long rc; | |
620 size_t len; | |
621 u_short *u; | |
622 ngx_err_t err; | |
623 u_short utf16[NGX_UTF16_BUFLEN]; | |
624 | |
625 len = NGX_UTF16_BUFLEN; | |
626 u = ngx_utf8_to_utf16(utf16, name, &len, 0); | |
627 | |
628 if (u == NULL) { | |
629 return NGX_FILE_ERROR; | |
630 } | |
631 | |
632 rc = NGX_FILE_ERROR; | |
633 | |
634 if (ngx_win32_check_filename(u, len, 0) != NGX_OK) { | |
635 goto failed; | |
636 } | |
637 | |
638 rc = RemoveDirectoryW(u); | |
603 | 639 |
604 failed: | 640 failed: |
605 | 641 |
606 if (u != utf16) { | 642 if (u != utf16) { |
607 err = ngx_errno; | 643 err = ngx_errno; |