[Bugs] [Bug 1193929] GlusterFS can be improved

bugzilla at redhat.com bugzilla at redhat.com
Fri Aug 24 16:27:48 UTC 2018


--- Comment #277 from Worker Ant <bugzilla-bot at gluster.org> ---
COMMIT: https://review.gluster.org/20919 committed in master by "Amar Tumballi"
<amarts at redhat.com> with a commit message-
{cli-cmd-parser|cli-rpc-ops||cli-xml-output}.c: strncpy()->sprintf(), reduce

strncpy may not be very efficient for short strings copied into
a large buffer: If the length of src is less than n,
strncpy() writes additional null bytes to dest to ensure
that a total of n bytes are written.

Instead, use snprintf().

- save the result of strlen() and re-use it when possible.
- move from GF_CALLOC() to GF_MALLOC() for the strings.
- move from strlen to sizeof() for const strings.

Compile-tested only!

Change-Id: I3cf49c5401ee100a5db6a4954c3d699ec1814c17
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul at redhat.com>

You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

More information about the Bugs mailing list