Unverified Commit 907eebe9 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #1012 from eric-buaa-cn/fix_pid_overwrite

bugfix: pid file may be overwritten
parents 88bf6106 4d5d8e26
......@@ -1669,7 +1669,7 @@ void Server::PutPidFileIfNeeded() {
return;
}
}
int fd = open(_options.pid_file.c_str(), O_WRONLY | O_CREAT, 0666);
int fd = open(_options.pid_file.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0) {
LOG(WARNING) << "Fail to open " << _options.pid_file;
_options.pid_file.clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment