From: Kefu Chai Date: Wed, 3 Jul 2019 04:52:15 +0000 (+0800) Subject: tools/rbd_nbd: use POSIX basename() X-Git-Tag: v15.1.0~2294^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f33119e699caaf4f2f0c15f54b29c68791643ce1;p=ceph-ci.git 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 --- diff --git a/src/tools/rbd_nbd/rbd-nbd.cc b/src/tools/rbd_nbd/rbd-nbd.cc index bf4195caee5..6d2f1b113ae 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;