Fix app manager/framework issues reported by Coverity (#1155)
runtime_sensor.c: add return value check for os_mutex_init
fix find_sensor_client
sensor_mgr_ref.c: add return value check for init_sensor_framework
app_manager_host.c: add return value check for app_manager_host_init
module_wasm_app.c: add bh_assert for m_data
fix mkdir potential issue
sample littlevgl/gui/simple: add return value check for init_sensor_framework
host_tool: add more check for g_conn_fd
This commit is contained in:
@ -207,10 +207,12 @@ app_instance_queue_callback(void *queue_msg, void *arg)
|
||||
|
||||
wasm_module_inst_t inst = (wasm_module_inst_t)arg;
|
||||
module_data *m_data = app_manager_get_module_data(Module_WASM_App, inst);
|
||||
wasm_data *wasm_app_data = (wasm_data *)m_data->internal_data;
|
||||
int message_type = bh_message_type(queue_msg);
|
||||
wasm_data *wasm_app_data;
|
||||
int message_type;
|
||||
|
||||
bh_assert(m_data);
|
||||
wasm_app_data = (wasm_data *)m_data->internal_data;
|
||||
message_type = bh_message_type(queue_msg);
|
||||
|
||||
if (message_type < BASE_EVENT_MAX) {
|
||||
switch (message_type) {
|
||||
@ -410,16 +412,15 @@ wasm_app_prepare_wasi_dir(wasm_module_t module, const char *module_name,
|
||||
p += module_name_len;
|
||||
*p++ = '\0';
|
||||
|
||||
/* Create a wasi dir for the module */
|
||||
if (stat(wasi_dir_buf, &st) == 0) {
|
||||
/* exist, but is a regular file, not a dir */
|
||||
if (st.st_mode & S_IFREG)
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
/* not exist, create it */
|
||||
if (mkdir(wasi_dir_buf, 0777) != 0)
|
||||
return false;
|
||||
if (mkdir(wasi_dir_buf, 0777) != 0) {
|
||||
if (errno == EEXIST) {
|
||||
/* Failed due to dir already exist */
|
||||
if ((stat(wasi_dir_buf, &st) == 0) && (st.st_mode & S_IFDIR)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user