]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/librbd: avoid copying a byte unnecessarily
authorPonnuvel Palaniyappan <pponnuvel@gmail.com>
Mon, 2 Mar 2020 23:10:49 +0000 (23:10 +0000)
committerPonnuvel Palaniyappan <pponnuvel@gmail.com>
Wed, 4 Mar 2020 10:48:55 +0000 (10:48 +0000)
Signed-off-by: Ponnuvel Palaniyappan <pponnuvel@gmail.com>
src/test/librbd/fsx.cc

index cee2a08960223fac08c2017b672c0be748bfcb94..503e0b2af2db0cf7434e1c656026c50f5c6dda90 100644 (file)
@@ -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)