From: Colin Patrick McCabe Date: Tue, 19 Jul 2011 00:21:37 +0000 (-0700) Subject: proflogger: Fix compiler warnings X-Git-Tag: v0.32~53^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=daeffbd5c20df98b39292b2adbc84aa6977389d1;p=ceph.git proflogger: Fix compiler warnings Signed-off-by: Colin McCabe --- diff --git a/src/common/ProfLogger.cc b/src/common/ProfLogger.cc index 6cf012fffcf4..1332a92c803d 100644 --- a/src/common/ProfLogger.cc +++ b/src/common/ProfLogger.cc @@ -150,7 +150,8 @@ public: struct sockaddr_un address; memset(&address, 0, sizeof(struct sockaddr_un)); address.sun_family = AF_UNIX; - snprintf(address.sun_path, sizeof(sockaddr_un::sun_path), sock_path.c_str()); + snprintf(address.sun_path, sizeof(sockaddr_un::sun_path), + "%s", sock_path.c_str()); if (bind(sock_fd, (struct sockaddr*)&address, sizeof(struct sockaddr_un)) != 0) { int err = errno; @@ -380,7 +381,7 @@ init(const std::string &uri) /* Set up things for the new thread */ std::string err; - int pipe_rd, pipe_wr; + int pipe_rd = -1, pipe_wr = -1; err = ProfLogThread::create_shutdown_pipe(&pipe_rd, &pipe_wr); if (!err.empty()) { lderr(m_cct) << "ProfLoggerCollection::init: error: " << err << dendl; diff --git a/src/test/proflogger.cc b/src/test/proflogger.cc index f2c897d6f292..0bd8338e148f 100644 --- a/src/test/proflogger.cc +++ b/src/test/proflogger.cc @@ -106,7 +106,7 @@ public: struct sockaddr_un address; memset(&address, 0, sizeof(struct sockaddr_un)); address.sun_family = AF_UNIX; - snprintf(address.sun_path, sizeof(address.sun_path), m_uri.c_str()); + snprintf(address.sun_path, sizeof(address.sun_path), "%s", m_uri.c_str()); if (connect(socket_fd, (struct sockaddr *) &address, sizeof(struct sockaddr_un)) != 0) {