From: Ponnuvel Palaniyappan Date: Mon, 2 Mar 2020 23:10:49 +0000 (+0000) Subject: test/librbd: avoid copying a byte unnecessarily X-Git-Tag: v16.0.0~62^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8fe44f6efb41039eef817f39c640370c65963f35;p=ceph.git test/librbd: avoid copying a byte unnecessarily Signed-off-by: Ponnuvel Palaniyappan --- diff --git a/src/test/librbd/fsx.cc b/src/test/librbd/fsx.cc index cee2a0896022..503e0b2af2db 100644 --- a/src/test/librbd/fsx.cc +++ b/src/test/librbd/fsx.cc @@ -2437,11 +2437,12 @@ void clone_filename(char *buf, size_t len, int clones) void clone_imagename(char *buf, size_t len, int clones) { - if (clones > 0) + if (clones > 0) { snprintf(buf, len, "%s-clone%d", iname, clones); - else - strncpy(buf, iname, len); - buf[len - 1] = '\0'; + } else { + strncpy(buf, iname, len - 1); + buf[len - 1] = '\0'; + } } void replay_imagename(char *buf, size_t len, int clones)