Add bfs_status() SDK API,activate FSImpl::ChangeReplicaNum()#930
Open
apady wants to merge 8 commits intobaidu:masterfrom
Open
Add bfs_status() SDK API,activate FSImpl::ChangeReplicaNum()#930apady wants to merge 8 commits intobaidu:masterfrom
apady wants to merge 8 commits intobaidu:masterfrom
Conversation
bug: bfs_change_replica_num()接口找不到定义 原因:bfs_c.cc函数命名与bfs_c.h命名不一致
bfs_change_replica_num()
yvxiang
reviewed
Dec 3, 2018
src/sdk/bfs_c.cc
Outdated
| if (ret != 0) { | ||
| return ret; | ||
| } | ||
| status=result.c_str(); |
Collaborator
There was a problem hiding this comment.
这里返回后,result析构,status中有野指针吧
Contributor
Author
There was a problem hiding this comment.
我把前一个return删了,您看这样能解决问题吗
Contributor
Author
There was a problem hiding this comment.
我重写了status接口,能请您看看还会有野指针的问题吗?
apady
commented
Dec 3, 2018
Contributor
Author
apady
left a comment
There was a problem hiding this comment.
c_str() 返回的 const char* 生命周期跟随 std::string result, result 为栈变量,当函数生命周期结束后会被编译器释放,可能导致status 成为野指针。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1.可以通过API 查看BFS 当前状态;
2.激活FSImpl::ChangeReplicaNum()方法。