This is an automated email from the ASF dual-hosted git repository.

jamesge pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 4d5d8e2  bugfix: pid file may be overwritten
     new 907eebe  Merge pull request #1012 from eric-buaa-cn/fix_pid_overwrite
4d5d8e2 is described below

commit 4d5d8e26f5048e1d8269a2b8efadfb64ea468140
Author: ericliu <eric...@yy.com>
AuthorDate: Thu Jan 2 20:02:24 2020 +0800

    bugfix: pid file may be overwritten
---
 src/brpc/server.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/brpc/server.cpp b/src/brpc/server.cpp
index 6c75fb6..a93e6d8 100644
--- a/src/brpc/server.cpp
+++ b/src/brpc/server.cpp
@@ -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();


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to