projects
/
platform
/
core
/
system
/
libstorage.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DD_LIST_FOREACH_SAFE should be used when there is node remove operation from list.
[platform/core/system/libstorage.git]
/
src
/
storage-external-dbus.c
diff --git
a/src/storage-external-dbus.c
b/src/storage-external-dbus.c
index
f389391
..
dcd1e9e
100755
(executable)
--- a/
src/storage-external-dbus.c
+++ b/
src/storage-external-dbus.c
@@
-205,7
+205,7
@@
int storage_ext_get_list(dd_list **list)
out:
if (ret < 0)
out:
if (ret < 0)
- storage_ext_release_list(list);
+ storage_ext_release_list(list);
//LCOV_EXCL_LINE System Error
g_variant_iter_free(iter);
g_variant_unref(result);
return ret;
g_variant_iter_free(iter);
g_variant_unref(result);
return ret;
@@
-320,19
+320,19
@@
int storage_ext_register_device_change(storage_ext_changed_cb func, void *data)
callback = (struct storage_ext_callback *)malloc(sizeof(struct storage_ext_callback));
if (!callback) {
callback = (struct storage_ext_callback *)malloc(sizeof(struct storage_ext_callback));
if (!callback) {
-//LCOV_EXCL_START System Error
+
//LCOV_EXCL_START System Error
_E("malloc() failed");
return -ENOMEM;
_E("malloc() failed");
return -ENOMEM;
-//LCOV_EXCL_STOP
+
//LCOV_EXCL_STOP
}
conn = get_dbus_connection();
if (!conn) {
}
conn = get_dbus_connection();
if (!conn) {
-//LCOV_EXCL_START System Error
+
//LCOV_EXCL_START System Error
free(callback);
_E("Failed to get dbus connection");
return -EPERM;
free(callback);
_E("Failed to get dbus connection");
return -EPERM;
-//LCOV_EXCL_STOP
+
//LCOV_EXCL_STOP
}
block_id = g_dbus_connection_signal_subscribe(conn,
}
block_id = g_dbus_connection_signal_subscribe(conn,
@@
-346,9
+346,11
@@
int storage_ext_register_device_change(storage_ext_changed_cb func, void *data)
NULL,
NULL);
if (block_id == 0) {
NULL,
NULL);
if (block_id == 0) {
+ //LCOV_EXCL_START System Error
free(callback);
_E("Failed to subscrive bus signal");
return -EPERM;
free(callback);
_E("Failed to subscrive bus signal");
return -EPERM;
+ //LCOV_EXCL_STOP
}
callback->func = func;
}
callback->func = func;
@@
-365,6
+367,7
@@
void storage_ext_unregister_device_change(storage_ext_changed_cb func)
GDBusConnection *conn;
struct storage_ext_callback *callback;
dd_list *elem;
GDBusConnection *conn;
struct storage_ext_callback *callback;
dd_list *elem;
+ dd_list *elem_n;
if (!func)
return;
if (!func)
return;
@@
-377,7
+380,7
@@
void storage_ext_unregister_device_change(storage_ext_changed_cb func)
//LCOV_EXCL_STOP
}
//LCOV_EXCL_STOP
}
- DD_LIST_FOREACH
(changed_list, elem
, callback) {
+ DD_LIST_FOREACH
_SAFE(changed_list, elem, elem_n
, callback) {
if (callback->func != func)
continue;
if (callback->block_id > 0)
if (callback->func != func)
continue;
if (callback->block_id > 0)
@@
-410,8
+413,10
@@
int storage_ext_get_device_info(int storage_id, storage_ext_device *info)
&info->readonly, &info->mount_point,
&info->state, &info->primary,
&info->flags, &info->storage_id);
&info->readonly, &info->mount_point,
&info->state, &info->primary,
&info->flags, &info->storage_id);
- } else
+ } else {
+ _E("No storage with the storage id (%d)", storage_id); //LCOV_EXCL_LINE
return -ENODEV;
return -ENODEV;
+ }
g_variant_unref(result);
g_variant_unref(result);