Add exception check
authorHyunbin Lee <hyunbin.lee@samsung.com>
Wed, 17 Jul 2013 06:34:31 +0000 (15:34 +0900)
committerhs321.lee <hs321.lee@samsung.com>
Mon, 26 Aug 2013 07:02:30 +0000 (16:02 +0900)
Conflicts:
rc/server/io/FIo_IpcServer.cpp

Change-Id: I2f956c7d2874e19117d6c512d1372489053faec7
Signed-off-by: Hyunbin Lee <hyunbin.lee@samsung.com>
Signed-off-by: hs321.lee <hs321.lee@samsung.com>
src/io/FIo_IpcClient.cpp
src/io/FIo_RegistryCore.cpp

index 3f03430..88c628c 100644 (file)
@@ -254,10 +254,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)
        {
index 5b779e6..1f0b50d 100644 (file)
@@ -22,6 +22,8 @@
 #include <unistd.h>
 #include <new>
 #include <unique_ptr.h>
+#include <string.h>
+#include <errno.h>
 
 #include <FBaseInteger.h>
 #include <FBaseDouble.h>
@@ -38,6 +40,7 @@
 
 #include <FBase_StringConverter.h>
 #include <FBase_LocalizedNumParser.h>
+#include <FBase_NativeError.h>
 #include <FApp_AppInfo.h>
 #include "FIo_FileImpl.h"
 #include "FIo_NormalRegistry.h"
@@ -1032,7 +1035,8 @@ _RegistryCore::PrepareToWrite(void)
        {
                unique_ptr<char[]> 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;
        }