From e7d5cfff305c261537c87a1c22db5fb819cbb437 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 24 May 2016 00:10:53 +0900 Subject: [PATCH] nghttpx: Fix crash introduced in the previous commit --- src/shrpx.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/shrpx.cc b/src/shrpx.cc index 0e19ad5f..ce617442 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -206,10 +206,11 @@ void save_pid() { std::vector temp_path; temp_path.reserve(get_config()->pid_file.size() + SUFFIX.size() + 1); - auto p = std::copy(std::begin(pid_file), std::end(pid_file), - std::begin(temp_path)); + std::copy(std::begin(pid_file), std::end(pid_file), + std::back_inserter(temp_path)); - p = std::copy(std::begin(SUFFIX), std::end(SUFFIX), p); + auto p = std::copy(std::begin(SUFFIX), std::end(SUFFIX), + std::back_inserter(temp_path)); *p = '\0'; auto fd = mkstemp(temp_path.data());