diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2017-09-04 17:32:29 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2017-09-04 17:32:29 +0300 |
commit | d57ec94a3f068705bd7eb163a7c7dba429a0e498 (patch) | |
tree | 2af7415c03c1bab09029eb10ba35c14bdef68793 /test/nxt_utf8_file_name_test.c | |
parent | ff515f43124ed0b05a2a352d7ec1ed0b22253c92 (diff) | |
download | unit-d57ec94a3f068705bd7eb163a7c7dba429a0e498.tar.gz unit-d57ec94a3f068705bd7eb163a7c7dba429a0e498.tar.bz2 |
Initialized task in utf8 unit test, fixes segfault in debug build.
Diffstat (limited to 'test/nxt_utf8_file_name_test.c')
-rw-r--r-- | test/nxt_utf8_file_name_test.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/nxt_utf8_file_name_test.c b/test/nxt_utf8_file_name_test.c index dc08f7e5..6861205e 100644 --- a/test/nxt_utf8_file_name_test.c +++ b/test/nxt_utf8_file_name_test.c @@ -44,7 +44,7 @@ nxt_utf8_file_name_test(nxt_thread_t *thr) ssize_t n; uint32_t uc, lc; nxt_int_t ret; - nxt_task_t *task = NULL; + nxt_task_t task; nxt_file_t uc_file, lc_file; const u_char *pp; nxt_file_name_t uc_name[10], lc_name[10]; @@ -73,6 +73,9 @@ nxt_utf8_file_name_test(nxt_thread_t *thr) lc_file.name = lc_name; + task.thread = thr; + task.log = thr->log; + for (uc = 0x41; uc < 0x110000; uc++) { p = nxt_utf8_encode(&uc_name[5], uc); @@ -106,7 +109,7 @@ nxt_utf8_file_name_test(nxt_thread_t *thr) *p = '\0'; - ret = nxt_file_open(task, &uc_file, NXT_FILE_WRONLY, NXT_FILE_TRUNCATE, + ret = nxt_file_open(&task, &uc_file, NXT_FILE_WRONLY, NXT_FILE_TRUNCATE, NXT_FILE_DEFAULT_ACCESS); if (ret != NXT_OK) { return NXT_ERROR; @@ -116,15 +119,15 @@ nxt_utf8_file_name_test(nxt_thread_t *thr) return NXT_ERROR; } - nxt_file_close(task, &uc_file); + nxt_file_close(&task, &uc_file); - ret = nxt_file_open(task, &lc_file, NXT_FILE_RDONLY, NXT_FILE_OPEN, + ret = nxt_file_open(&task, &lc_file, NXT_FILE_RDONLY, NXT_FILE_OPEN, NXT_FILE_DEFAULT_ACCESS); if (ret == NXT_OK) { n = nxt_file_read(&lc_file, test, 4, 0); - nxt_file_close(task, &lc_file); + nxt_file_close(&task, &lc_file); if (n != 4 || nxt_memcmp(utf8, test, 4) != 0) { nxt_log_alert(thr->log, "nxt_file_read() mismatch"); |