Mercurial > hg > nginx
comparison src/core/ngx_file.c @ 1747:442a791354d8
create the only cleanup
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 17 Dec 2007 21:23:05 +0000 |
parents | e584e946e198 |
children | 91d381e4e691 |
comparison
equal
deleted
inserted
replaced
1746:3c0b44825071 | 1747:442a791354d8 |
---|---|
59 | 59 |
60 ngx_memcpy(file->name.data, path->name.data, path->name.len); | 60 ngx_memcpy(file->name.data, path->name.data, path->name.len); |
61 | 61 |
62 n = (uint32_t) ngx_next_temp_number(0); | 62 n = (uint32_t) ngx_next_temp_number(0); |
63 | 63 |
64 cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t)); | |
65 if (cln == NULL) { | |
66 return NGX_ERROR; | |
67 } | |
68 | |
64 for ( ;; ) { | 69 for ( ;; ) { |
65 (void) ngx_sprintf(file->name.data + path->name.len + 1 + path->len, | 70 (void) ngx_sprintf(file->name.data + path->name.len + 1 + path->len, |
66 "%010uD%Z", n); | 71 "%010uD%Z", n); |
67 | 72 |
68 ngx_create_hashed_filename(file, path); | 73 ngx_create_hashed_filename(file, path); |
69 | |
70 cln = ngx_pool_cleanup_add(pool, sizeof(ngx_pool_cleanup_file_t)); | |
71 if (cln == NULL) { | |
72 return NGX_ERROR; | |
73 } | |
74 | 74 |
75 file->fd = ngx_open_tempfile(file->name.data, persistent, access); | 75 file->fd = ngx_open_tempfile(file->name.data, persistent, access); |
76 | 76 |
77 ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0, | 77 ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0, |
78 "temp fd:%d", file->fd); | 78 "temp fd:%d", file->fd); |