]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw_file: split last argv on ws, if provided
authorMatt Benjamin <mbenjamin@redhat.com>
Tue, 17 Jan 2017 16:23:45 +0000 (11:23 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 2 Feb 2017 19:16:53 +0000 (14:16 -0500)
This is intended to allow an "extra" unparsed argument string
containing various cmdline options to be passed as the last argument
in the argv array of librgw_create(), which nfs-ganesha is
expecting to happen.

While at it, hook env_args() too.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/librgw.cc

index e296350abb0720aa7a8d454d8568c4e8b94cef30..2ee969267e7debfe9588d6379359819aa9f5c821 100644 (file)
@@ -647,7 +647,18 @@ int librgw_create(librgw_t* rgw, int argc, char **argv)
     std::lock_guard<std::mutex> lg(librgw_mtx);
     if (! g_ceph_context) {
       vector<const char*> args;
+      std::vector<std::string> spl_args;
+      // last non-0 argument will be split and consumed
+      if (argc > 1) {
+       const std::string spl_arg{argv[(--argc)]};
+       get_str_vec(spl_arg, " \t", spl_args);
+      }
       argv_to_vec(argc, const_cast<const char**>(argv), args);
+      // append split args, if any
+      for (const auto& elt : spl_args) {
+       args.push_back(elt.c_str());
+      }
+      env_to_vec(args);
       rc = rgwlib.init(args);
     }
   }