From: Adam Malinowski Date: Fri, 25 Jul 2014 09:48:43 +0000 (+0200) Subject: Reduce scope of variables X-Git-Tag: accepted/tizen/common/20140725.183156^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7c43f6d5493322520118501a7e88aeb2fbf83a2;p=platform%2Fcore%2Fsecurity%2Fcynara.git Reduce scope of variables Change-Id: Ib18cde12f9508cb17469bcef0bb38a6665d6297d --- diff --git a/src/common/sockets/Socket.cpp b/src/common/sockets/Socket.cpp index 5149d17..e666262 100644 --- a/src/common/sockets/Socket.cpp +++ b/src/common/sockets/Socket.cpp @@ -143,9 +143,8 @@ bool Socket::connect(void) { int retval = TEMP_FAILURE_RETRY(::connect(m_sock, (struct sockaddr*)&clientAddr, SUN_LEN(&clientAddr))); - int err = 0; if (retval == -1) { - err = errno; + int err = errno; if (err == EINPROGRESS) { if (!waitForSocket(POLLOUT)) { return false; @@ -165,7 +164,6 @@ bool Socket::connect(void) { } bool Socket::sendToServer(BinaryQueue &queue) { - ssize_t done = 0; bool retry = false; RawBuffer buffer(queue.size()); @@ -178,7 +176,7 @@ bool Socket::sendToServer(BinaryQueue &queue) { } retry = false; - done = 0; + ssize_t done = 0; while ((buffer.size() - done) > 0) { if (! waitForSocket(POLLOUT)) { LOGE("Error in poll(POLLOUT)"); diff --git a/src/service/main/main.cpp b/src/service/main/main.cpp index ce7b07b..23362c2 100644 --- a/src/service/main/main.cpp +++ b/src/service/main/main.cpp @@ -34,8 +34,6 @@ #include "Cynara.h" int main(int argc UNUSED, char **argv UNUSED) { - int ret; - init_log(); try { @@ -44,7 +42,7 @@ int main(int argc UNUSED, char **argv UNUSED) { cynara.init(); LOGI("Cynara service is started"); - ret = sd_notify(0, "READY=1"); + int ret = sd_notify(0, "READY=1"); if (ret == 0) { LOGW("Cynara was not configured to notify its status"); } else if (ret < 0) {