From: Hyunbin Lee Date: Wed, 17 Jul 2013 06:34:31 +0000 (+0900) Subject: Add exception check X-Git-Tag: accepted/tizen/20130912.081851^2~113 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9bc18f1d0d0218a9ee6197b9588ff18e623004d0;p=platform%2Fframework%2Fnative%2Fappfw.git Add exception check Change-Id: I2f956c7d2874e19117d6c512d1372489053faec7 Signed-off-by: Hyunbin Lee --- diff --git a/src/io/FIo_IpcClient.cpp b/src/io/FIo_IpcClient.cpp index 3874bcd..6e4417e 100644 --- a/src/io/FIo_IpcClient.cpp +++ b/src/io/FIo_IpcClient.cpp @@ -276,10 +276,12 @@ _IpcClient::MakeConnection(bool forReverse) } ret = fcntl(client, F_SETFL, flags); - SysTryCatch(NID_IO, ret >= 0 , r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to set file status flags (%d, %s).", + SysTryCatch(NID_IO, ret >= 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to set file status flags (%d, %s).", errno, strerror(errno)); ret = write(client, &helloMessage, sizeof(helloMessage)); + SysTryCatch(NID_IO, ret >= 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to send hello message (%d, %s).", + errno, strerror(errno)); if (forReverse) { diff --git a/src/io/FIo_RegistryCore.cpp b/src/io/FIo_RegistryCore.cpp index 5d2b816..714c8a8 100644 --- a/src/io/FIo_RegistryCore.cpp +++ b/src/io/FIo_RegistryCore.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -38,6 +40,7 @@ #include #include +#include #include #include "FIo_FileImpl.h" #include "FIo_NormalRegistry.h" @@ -1036,7 +1039,8 @@ _RegistryCore::PrepareToWrite(void) { unique_ptr pFilePath(_StringConverter::CopyToCharArrayN(_regPath)); int res = truncate(pFilePath.get(), 0); - + SysTryReturnResult(NID_IO, res == 0, __ConvertNativeErrorToResult(errno), + "Failed to truncate. errno: %d (%s)", errno, strerror(errno)); return E_SUCCESS; } diff --git a/src/server/io/FIo_IpcServer.cpp b/src/server/io/FIo_IpcServer.cpp index 47f1e7d..7c8c0c8 100644 --- a/src/server/io/FIo_IpcServer.cpp +++ b/src/server/io/FIo_IpcServer.cpp @@ -290,7 +290,7 @@ _IpcServer::OnConnectionRequest(GIOChannel* source, GIOCondition condition, gpoi _ChannelInfo* pChannelInfo = null; GSource* pGSource = null; GIOChannel* pChannel = null; - ssize_t res = 0; + ssize_t readBytes = 0; int server = -1; int client = -1; @@ -305,7 +305,9 @@ _IpcServer::OnConnectionRequest(GIOChannel* source, GIOCondition condition, gpoi client = accept(server, (struct sockaddr*) &clientAddress, &clientLen); SysTryCatch(NID_IO, client != -1, , E_SYSTEM, "[E_SYSTEM] Accept failed."); - res = read(client, &helloMessage, sizeof(helloMessage)); + readBytes = read(client, &helloMessage, sizeof(helloMessage)); + SysTryCatch(NID_IO, readBytes >= 0, , E_SYSTEM, "[E_SYSTEM] Failed to receive hello message (%d, %s).", + errno, strerror(errno)); helloMessage.appId[255] = '\0'; pChannel = g_io_channel_unix_new(client);