[core] fix potential streaming tempfile corruption (fixes #2760)
commit23503883babccc578ddde4a5b9a4a6d2cd020320
authorGlenn Strauss <gstrauss@gluelogic.com>
Fri, 28 Oct 2016 18:05:07 +0000 (28 14:05 -0400)
committerGlenn Strauss <gstrauss@gluelogic.com>
Sat, 29 Oct 2016 13:14:07 +0000 (29 09:14 -0400)
treeb470a6dcdbe181ed1eb27192b27c274d5840e586
parenteb37615a47de85a53909225706cb9240652c704a
[core] fix potential streaming tempfile corruption (fixes #2760)

set O_APPEND after mkstemp() in chunk.c  (mkostemp() is not as portable)
(also set FD_CLOEXEC to avoid potentially leaking open tempfiles to CGI)

(thx dieter.ro for helping track this down)

x-ref:
  https://redmine.lighttpd.net/boards/3/topics/6884
  "potential tempfile corruption when streaming response"
  https://redmine.lighttpd.net/issues/2760
src/chunk.c