Add readlink failure case of timezone
authorJoohyun Kim <joohyune.kim@samsung.com>
Mon, 2 Sep 2013 02:08:33 +0000 (11:08 +0900)
committerJoohyun Kim <joohyune.kim@samsung.com>
Mon, 2 Sep 2013 02:08:33 +0000 (11:08 +0900)
Change-Id: I08a3d254091ac696dbc5785e314e8f672f02b197
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
src/system-server/setting/providers/FSys_SettingLocaleProvider.cpp

index a370116..fc8b4ab 100644 (file)
@@ -300,7 +300,7 @@ _SettingLocaleProvider::GetValue(const String& key, String& value)
        {
                SysTryReturnResult(NID_SYS, HasKey(key) == true, E_UNSUPPORTED_OPERATION, "Current device does not support date format feature.");
                r = E_SUCCESS;
-               
+
                unique_ptr<char, charDeleter> pDateFormat(__icu.GetDateTimeFormatN(_ICU_DATE_FORMAT));
                SysTryReturnResult(NID_SYS, pDateFormat.get() != null, E_SYSTEM, "It is failed to get date format");
 
@@ -377,14 +377,18 @@ _SettingLocaleProvider::GetValue(const String& key, String& value)
                ssize_t nLen = readlink(_LOCALE_TIMEZONE_LINK, pTZPath, sizeof(pTZPath)-1);
                if (nLen != -1)
                {
+                       value.Clear();
                        pTZPath[nLen] = '\0';
+                       value.Append(&pTZPath[_LOCALE_TIMEZONE_ROOT_PATH_LENGTH]);
                }
                else
                {
-                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get timezone");
+                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get timezone from readlink.");
+                       unique_ptr<char, charDeleter> pTimeZone(vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID));
+                       SysTryReturnResult(NID_SYS, pTimeZone != null, E_SYSTEM, "It is failed to get timezone from vconf also.");
+                       value.Clear();
+                       value.Append(pTimeZone.get());
                }
-               value.Clear();
-               value.Append(&pTZPath[_LOCALE_TIMEZONE_ROOT_PATH_LENGTH]);
        }
        else if (key == _LOCALE_DATE)
        {