From f33119e699caaf4f2f0c15f54b29c68791643ce1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 3 Jul 2019 12:52:15 +0800 Subject: [PATCH] tools/rbd_nbd: use POSIX basename() * glibc offers two variants of basename(). one modifies the content of `path`, the other does not. to be standard compliant, and to fix the FTBFS with musl-libc, we need to use the POSIX variant. * #include for basename(3), the POSIX compliant one. see http://pubs.opengroup.org/onlinepubs/009695399/functions/basename.html Signed-off-by: Kefu Chai --- src/tools/rbd_nbd/rbd-nbd.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc index bf4195caee51..6d2f1b113ae1 100644 --- a/src/tools/rbd_nbd/rbd-nbd.cc +++ b/src/tools/rbd_nbd/rbd-nbd.cc @@ -18,6 +18,7 @@ #include "include/int_types.h" +#include #include #include #include @@ -562,7 +563,7 @@ private: ifs >> cmdline; for (unsigned i = 0; i < cmdline.size(); i++) { - const char *arg = &cmdline[i]; + char *arg = &cmdline[i]; if (i == 0) { if (strcmp(basename(arg) , "rbd-nbd") != 0) { return -EINVAL; -- 2.47.3