From: Danny Al-Gaaf Date: Mon, 25 Feb 2013 13:10:20 +0000 (+0100) Subject: Paxos.h: fix dangerouse use of c_str() X-Git-Tag: v0.59~124^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=350481f90fc5abaa60cfa986160efb19c27b4af3;p=ceph.git 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 --- diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h index ccabb43802899..1edfbc853a5d4 100644 --- a/src/mon/Paxos.h +++ b/src/mon/Paxos.h @@ -191,7 +191,7 @@ public: * @param s State value. * @return The state's name. */ - static const char *get_statename(int s) { + static const string get_statename(int s) { stringstream ss; if (s & STATE_RECOVERING) { ss << "recovering"; @@ -211,7 +211,7 @@ public: if (s & STATE_LOCKED) ss << " (locked)"; - return ss.str().c_str(); + return ss.str(); } private: