[core] check fcntl O_APPEND succeeds w/ mkstemp()

personal/stbuehler/mod-csrf
Glenn Strauss 2016-10-29 10:32:41 -04:00
parent 5ee1483373
commit 06cc3dfa59
1 changed files with 5 additions and 1 deletions

View File

@ -481,8 +481,12 @@ static chunk *chunkqueue_get_append_tempfile(chunkqueue *cq) {
return NULL;
}
if (0 != fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_APPEND)) {
close(fd);
buffer_free(template);
return NULL;
}
fd_close_on_exec(fd);
(void)fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_APPEND);
c = chunkqueue_get_unused_chunk(cq);
c->type = FILE_CHUNK;