You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ja...@apache.org on 2020/01/03 03:16:49 UTC

[incubator-brpc] branch master updated: bugfix: pid file may be overwritten

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 <er...@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-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org