Hello. On 03/05/2014 05:14 PM, Krzysztof Opasiak wrote:
usbg_parse_bindings() function has done parsing incorrectly and in inefficent way. Changes made in this function provide better performance and fix wrong linking issue when having two instances of the same function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx> --- src/usbg.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/src/usbg.c b/src/usbg.c index 198fc7a..255074f 100644 --- a/src/usbg.c +++ b/src/usbg.c
[...]
@@ -420,19 +423,22 @@ static void usbg_parse_config_bindings(usbg_config *c) TAILQ_INIT(&c->bindings); n = scandir(bpath, &dent, bindings_select, alphasort);
[...]
+ for (i = 0; i < n; i++) { + sprintf(file_name, "%s/%s", bpath, dent[i]->d_name); + nmb = readlink(file_name, target, USBG_MAX_PATH_LENGTH); + if (nmb < 0) + ERRORNO("bytes %d contents %s\n", n, target); + + /* readlink() don't add this, so we have to do it manually */ + target[nmb] = '\0'; + /* Target contains a full path + * but we need only function dir name */ + target_name = strrchr(target, '/') + 1;
Why the indentation jumped suddenly to the right? I know I'm asking this question for the 2nd time already. :-)
WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html