diff options
author | taeyoung <ty317.kim@samsung.com> | 2016-09-23 19:03:05 +0900 |
---|---|---|
committer | taeyoung <ty317.kim@samsung.com> | 2016-09-23 19:03:32 +0900 |
commit | f28463f3d87d0cbcf9a66647f455283c0d045a69 (patch) | |
tree | 5532908132f03086fca43c38e2ca40370eb446b2 /src | |
parent | d25dbaed77aeb19345d57af73f64989a1d5e6265 (diff) | |
download | libusbg-f28463f3d87d0cbcf9a66647f455283c0d045a69.tar.gz libusbg-f28463f3d87d0cbcf9a66647f455283c0d045a69.tar.bz2 libusbg-f28463f3d87d0cbcf9a66647f455283c0d045a69.zip |
Revert "common: fix minor issues."
This reverts commit d25dbaed77aeb19345d57af73f64989a1d5e6265.
Change-Id: Ic6abcb23180f4b015b41a994b36f78607bd0081c
Signed-off-by: taeyoung <ty317.kim@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/usbg.c | 12 | ||||
-rw-r--r-- | src/usbg_schemes_libconfig.c | 9 |
2 files changed, 9 insertions, 12 deletions
@@ -901,9 +901,9 @@ static int usbg_rm_all_dirs(const char *path) return ret; } -char *usbg_ether_ntoa_r(const struct ether_addr *addr, char *buf, size_t len) +char *usbg_ether_ntoa_r(const struct ether_addr *addr, char *buf) { - snprintf(buf, len, "%02x:%02x:%02x:%02x:%02x:%02x", + sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", addr->ether_addr_octet[0], addr->ether_addr_octet[1], addr->ether_addr_octet[2], addr->ether_addr_octet[3], addr->ether_addr_octet[4], addr->ether_addr_octet[5]); @@ -3090,12 +3090,12 @@ int usbg_set_function_net_attrs(usbg_function *f, const usbg_f_net_attrs *attrs) goto out; } - addr = usbg_ether_ntoa_r(&attrs->dev_addr, addr_buf, sizeof(addr_buf)); + addr = usbg_ether_ntoa_r(&attrs->dev_addr, addr_buf); ret = usbg_write_string(f->path, f->name, "dev_addr", addr); if (ret != USBG_SUCCESS) goto out; - addr = usbg_ether_ntoa_r(&attrs->host_addr, addr_buf, sizeof(addr_buf)); + addr = usbg_ether_ntoa_r(&attrs->host_addr, addr_buf); ret = usbg_write_string(f->path, f->name, "host_addr", addr); if (ret != USBG_SUCCESS) goto out; @@ -3390,7 +3390,7 @@ int usbg_set_net_dev_addr(usbg_function *f, struct ether_addr *dev_addr) if (f && dev_addr) { char str_buf[USBG_MAX_STR_LENGTH]; - char *str_addr = usbg_ether_ntoa_r(dev_addr, str_buf, sizeof(str_buf)); + char *str_addr = usbg_ether_ntoa_r(dev_addr, str_buf); ret = usbg_write_string(f->path, f->name, "dev_addr", str_addr); } else { ret = USBG_ERROR_INVALID_PARAM; @@ -3405,7 +3405,7 @@ int usbg_set_net_host_addr(usbg_function *f, struct ether_addr *host_addr) if (f && host_addr) { char str_buf[USBG_MAX_STR_LENGTH]; - char *str_addr = usbg_ether_ntoa_r(host_addr, str_buf, sizeof(str_buf)); + char *str_addr = usbg_ether_ntoa_r(host_addr, str_buf); ret = usbg_write_string(f->path, f->name, "host_addr", str_addr); } else { ret = USBG_ERROR_INVALID_PARAM; diff --git a/src/usbg_schemes_libconfig.c b/src/usbg_schemes_libconfig.c index 77638ce..c8944ed 100644 --- a/src/usbg_schemes_libconfig.c +++ b/src/usbg_schemes_libconfig.c @@ -326,7 +326,7 @@ static int usbg_export_f_net_attrs(usbg_f_net_attrs *attrs, if (!node) goto out; - addr = usbg_ether_ntoa_r(&attrs->dev_addr, addr_buf, sizeof(addr_buf)); + addr = usbg_ether_ntoa_r(&attrs->dev_addr, addr_buf); cfg_ret = config_setting_set_string(node, addr); if (cfg_ret != CONFIG_TRUE) { ret = USBG_ERROR_OTHER_ERROR; @@ -337,7 +337,7 @@ static int usbg_export_f_net_attrs(usbg_f_net_attrs *attrs, if (!node) goto out; - addr = usbg_ether_ntoa_r(&attrs->host_addr, addr_buf, sizeof(addr_buf)); + addr = usbg_ether_ntoa_r(&attrs->host_addr, addr_buf); cfg_ret = config_setting_set_string(node, addr); if (cfg_ret != CONFIG_TRUE) { ret = USBG_ERROR_OTHER_ERROR; @@ -1120,7 +1120,7 @@ static int usbg_import_f_ms_attrs(config_setting_t *root, usbg_function *f) } luns_node = config_setting_get_member(root, "luns"); - if (!luns_node) { + if (!node) { ret = USBG_ERROR_INVALID_PARAM; goto out; } @@ -1861,9 +1861,6 @@ static int usbg_import_gadget_strings(config_setting_t *root, usbg_gadget *g) for (i = 0; i < count; ++i) { node = config_setting_get_elem(root, i); - if (!node) - continue; - if (!config_setting_is_group(node)) { ret = USBG_ERROR_INVALID_TYPE; break; |