diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2016-10-29 10:32:41 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2016-10-29 10:32:41 -0400 |
commit | 06cc3dfa592853cdb8ba36ec0be610dbe9bb8012 (patch) | |
tree | 6e64410d40f304f8b932a3a8a901b73e8a38d1fa /src | |
parent | 5ee14833733593ef8f7f1bef1bbd788dd20c774e (diff) | |
download | lighttpd-git-06cc3dfa592853cdb8ba36ec0be610dbe9bb8012.tar.gz |
[core] check fcntl O_APPEND succeeds w/ mkstemp()
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/chunk.c b/src/chunk.c index 82dab6e0..fd431a22 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -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; |