Revision: 6743
Author: ek.kato
Date: Tue Sep 7 22:34:34 2010
Log: * uim/uim-posix.c
- (uim_get_config_path_internal)
- Make sure to return "" as a path when failed.
- (c_get_config_path)
- Remove a check for the path.
http://code.google.com/p/uim/source/detail?r=6743
Modified:
/trunk/uim/uim-posix.c
=======================================
--- /trunk/uim/uim-posix.c Tue Sep 7 21:56:43 2010
+++ /trunk/uim/uim-posix.c Tue Sep 7 22:34:34 2010
@@ -186,15 +186,21 @@
if (!uim_get_home_directory(home, sizeof(home), getuid()) && is_getenv) {
char *home_env = getenv("HOME");
- if (!home_env)
+ if (!home_env) {
+ path[0] = '\0';
return UIM_FALSE;
-
- if (strlcpy(home, home_env, sizeof(home)) >= sizeof(home))
+ }
+
+ if (strlcpy(home, home_env, sizeof(home)) >= sizeof(home)) {
+ path[0] = '\0';
return UIM_FALSE;
+ }
}
- if (snprintf(path, len, "%s/.uim.d", home) == -1)
+ if (snprintf(path, len, "%s/.uim.d", home) < 0) {
+ path[0] = '\0';
return UIM_FALSE;
+ }
if (!uim_check_dir_internal(path, need_prepare)) {
return UIM_FALSE;
@@ -228,9 +234,11 @@
{
char path[MAXPATHLEN];
int need_prepare = UIM_FALSE;
-
- if (!uim_get_config_path_internal(path, sizeof(path),
C_BOOL(is_getenv_), need_prepare))
- return uim_scm_f();
+ int exist;
+
+ /* No need to check the existence of path in this function */
+ exist = uim_get_config_path_internal(path, sizeof(path),
C_BOOL(is_getenv_), need_prepare);
+
return MAKE_STR(path);
}