projects
/
platform
/
core
/
uifw
/
stt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix engine parser to access directories
[platform/core/uifw/stt.git]
/
engine-parser
/
src
/
stt-engine-parser.c
diff --git
a/engine-parser/src/stt-engine-parser.c
b/engine-parser/src/stt-engine-parser.c
index
ecf2ba0
..
281818c
100644
(file)
--- a/
engine-parser/src/stt-engine-parser.c
+++ b/
engine-parser/src/stt-engine-parser.c
@@
-24,6
+24,7
@@
#include <pkgmgr_installer_info.h>
#include <stdio.h>
#include <sys/stat.h>
#include <pkgmgr_installer_info.h>
#include <stdio.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include <sys/types.h>
#include <tzplatform_config.h>
#include <systemd/sd-login.h>
#include <sys/types.h>
#include <tzplatform_config.h>
#include <systemd/sd-login.h>
@@
-161,9
+162,11
@@
static int __save_engine_info_xml(const char *pkgid, gchar *ut, uid_t uid, gid_t
LOGD("[DEBUG] dir_engine_info(%s)", dir_engine_info);
/* Make directories */
LOGD("[DEBUG] dir_engine_info(%s)", dir_engine_info);
/* Make directories */
- if (0 != access(dir_config_base, F_OK)) {
+// if (0 != access(dir_config_base, F_OK)) {
+ if (-1 == open(dir_config_base, O_DIRECTORY)) {
+ LOGE("[INFO] No directory : %s, errno : %d", dir_config_base, errno);
if (0 != mkdir(dir_config_base, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
if (0 != mkdir(dir_config_base, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- LOGE("[ERROR] Fail to make directory : %s
", dir_config_base
);
+ LOGE("[ERROR] Fail to make directory : %s
, errno : %d", dir_config_base, errno
);
free(dir_config_base);
dir_config_base = NULL;
free(dir_home);
free(dir_config_base);
dir_config_base = NULL;
free(dir_home);
@@
-176,16
+179,18
@@
static int __save_engine_info_xml(const char *pkgid, gchar *ut, uid_t uid, gid_t
} else {
LOGD("Success to make directory : %s", dir_config_base);
if (0 != chown(dir_config_base, tmp_uid, tmp_gid)) {
} else {
LOGD("Success to make directory : %s", dir_config_base);
if (0 != chown(dir_config_base, tmp_uid, tmp_gid)) {
- LOGD("[ERROR] Fail to change user and group
"
);
+ LOGD("[ERROR] Fail to change user and group
, errno : %d", errno
);
} else {
LOGD("[DEBUG] Success to change user and group");
}
}
}
} else {
LOGD("[DEBUG] Success to change user and group");
}
}
}
- if (0 != access(dir_home, F_OK)) {
+// if (0 != access(dir_home, F_OK)) {
+ if (-1 == open(dir_home, O_DIRECTORY)) {
+ LOGE("[INFO] No directory : %s, errno : %d", dir_home, errno);
if (0 != mkdir(dir_home, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
if (0 != mkdir(dir_home, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- LOGE("[ERROR] Fail to make directory : %s
", dir_home
);
+ LOGE("[ERROR] Fail to make directory : %s
, errno : %d", dir_home, errno
);
free(dir_config_base);
dir_config_base = NULL;
free(dir_home);
free(dir_config_base);
dir_config_base = NULL;
free(dir_home);
@@
-198,16
+203,18
@@
static int __save_engine_info_xml(const char *pkgid, gchar *ut, uid_t uid, gid_t
} else {
LOGD("Success to make directory : %s", dir_home);
if (0 != chown(dir_home, tmp_uid, tmp_gid)) {
} else {
LOGD("Success to make directory : %s", dir_home);
if (0 != chown(dir_home, tmp_uid, tmp_gid)) {
- LOGD("[ERROR] Fail to change user and group
"
);
+ LOGD("[ERROR] Fail to change user and group
, errno : %d", errno
);
} else {
LOGD("[DEBUG] Success to change user and group");
}
}
}
} else {
LOGD("[DEBUG] Success to change user and group");
}
}
}
- if (0 != access(dir_engine_base, F_OK)) {
+// if (0 != access(dir_engine_base, F_OK)) {
+ if (-1 == open(dir_engine_base, O_DIRECTORY)) {
+ LOGE("[INFO] No directory : %s, errno : %d", dir_engine_base, errno);
if (0 != mkdir(dir_engine_base, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
if (0 != mkdir(dir_engine_base, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- LOGE("[ERROR] Fail to make directory : %s
", dir_engine_base
);
+ LOGE("[ERROR] Fail to make directory : %s
, errno : %d", dir_engine_base, errno
);
free(dir_config_base);
dir_config_base = NULL;
free(dir_home);
free(dir_config_base);
dir_config_base = NULL;
free(dir_home);
@@
-220,16
+227,18
@@
static int __save_engine_info_xml(const char *pkgid, gchar *ut, uid_t uid, gid_t
} else {
LOGD("Success to make directory : %s", dir_engine_base);
if (0 != chown(dir_engine_base, tmp_uid, tmp_gid)) {
} else {
LOGD("Success to make directory : %s", dir_engine_base);
if (0 != chown(dir_engine_base, tmp_uid, tmp_gid)) {
- LOGD("[ERROR] Fail to change user and group
"
);
+ LOGD("[ERROR] Fail to change user and group
, errno : %d", errno
);
} else {
LOGD("[DEBUG] Success to change user and group");
}
}
}
} else {
LOGD("[DEBUG] Success to change user and group");
}
}
}
- if (0 != access(dir_engine_info, F_OK)) {
+// if (0 != access(dir_engine_info, F_OK)) {
+ if (-1 == open(dir_engine_info, O_DIRECTORY)) {
+ LOGE("[INFO] No directory : %s, errno : %d", dir_engine_info, errno);
if (0 != mkdir(dir_engine_info, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
if (0 != mkdir(dir_engine_info, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- LOGE("[ERROR] Fail to make directory : %s
", dir_engine_inf
o);
+ LOGE("[ERROR] Fail to make directory : %s
, errno : %d", dir_engine_info, errn
o);
free(dir_config_base);
dir_config_base = NULL;
free(dir_home);
free(dir_config_base);
dir_config_base = NULL;
free(dir_home);
@@
-242,7
+251,7
@@
static int __save_engine_info_xml(const char *pkgid, gchar *ut, uid_t uid, gid_t
} else {
LOGD("Success to make directory : %s", dir_engine_info);
if (0 != chown(dir_engine_info, tmp_uid, tmp_gid)) {
} else {
LOGD("Success to make directory : %s", dir_engine_info);
if (0 != chown(dir_engine_info, tmp_uid, tmp_gid)) {
- LOGD("[ERROR] Fail to change user and group
"
);
+ LOGD("[ERROR] Fail to change user and group
, errno : %d", errno
);
} else {
LOGD("[DEBUG] Success to change user and group");
}
} else {
LOGD("[DEBUG] Success to change user and group");
}