mirror of
https://github.com/ceph/ceph
synced 2025-04-11 04:02:04 +00:00
Paxos.h: fix dangerouse use of c_str()
No need to use c_str() in get_statename(), simply return a std::strin instead. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
parent
9217c4ac68
commit
350481f90f
@ -191,7 +191,7 @@ public:
|
|||||||
* @param s State value.
|
* @param s State value.
|
||||||
* @return The state's name.
|
* @return The state's name.
|
||||||
*/
|
*/
|
||||||
static const char *get_statename(int s) {
|
static const string get_statename(int s) {
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
if (s & STATE_RECOVERING) {
|
if (s & STATE_RECOVERING) {
|
||||||
ss << "recovering";
|
ss << "recovering";
|
||||||
@ -211,7 +211,7 @@ public:
|
|||||||
|
|
||||||
if (s & STATE_LOCKED)
|
if (s & STATE_LOCKED)
|
||||||
ss << " (locked)";
|
ss << " (locked)";
|
||||||
return ss.str().c_str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user