]> git.droids-corp.org - dpdk.git/commitdiff
eal: remove unnecessary null-termination in plugin path
authorBruce Richardson <bruce.richardson@intel.com>
Fri, 3 Jul 2020 10:23:29 +0000 (11:23 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 5 Jul 2020 19:32:40 +0000 (21:32 +0200)
Since strlcpy always null-terminates, and the buffer is zeroed before copy
anyway, there is no need to explicitly zero the end of the character
array, or to limit the bytes that strlcpy can write.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/common/eal_common_options.c

index 24b223ebfd0f37e3b019310b95b8e306fbcdb796..75e8839c3d75ff1064dba902f0fe1addc2f0616f 100644 (file)
@@ -352,8 +352,7 @@ eal_plugin_add(const char *path)
                return -1;
        }
        memset(solib, 0, sizeof(*solib));
-       strlcpy(solib->name, path, PATH_MAX-1);
-       solib->name[PATH_MAX-1] = 0;
+       strlcpy(solib->name, path, PATH_MAX);
        TAILQ_INSERT_TAIL(&solib_list, solib, next);
 
        return 0;