jamesge commented on a change in pull request #1252:
URL: https://github.com/apache/incubator-brpc/pull/1252#discussion_r508272917
##########
File path: src/brpc/builtin/common.cpp
##########
@@ -331,13 +331,10 @@ int FileChecksum(const char* file_path, unsigned char*
checksum) {
static pthread_once_t create_program_name_once = PTHREAD_ONCE_INIT;
static const char* s_program_name = "unknown";
-static char s_cmdline[256];
+static std::string s_command_line;
Review comment:
这个不用动,这么改在main函数后运行会有问题的
##########
File path: src/butil/process_util.cc
##########
@@ -32,17 +33,22 @@
namespace butil {
-ssize_t ReadCommandLine(char* buf, size_t len, bool with_args) {
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+std::string ReadCommandLine(bool with_args) {
Review comment:
建议原来的函数保留(可以设为static),在外面再封装一层,另外这里用到的PATH_MAX支持除linux之外的系统吗?
##########
File path: src/bvar/default_variables.cpp
##########
@@ -592,9 +592,8 @@ class DiskStatReader {
struct ReadSelfCmdline {
std::string content;
ReadSelfCmdline() {
- char buf[1024];
- const ssize_t nr = butil::ReadCommandLine(buf, sizeof(buf), true);
- content.append(buf, nr);
+ std::string cmdline= butil::ReadCommandLine(true);
Review comment:
给content直接赋值就行了吧
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]