From: Varsha Rao Date: Tue, 14 Jan 2020 16:07:09 +0000 (+0530) Subject: client: Add is_dir check before changing directory X-Git-Tag: v15.1.0~152^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=20fa3940bdbb1e7a9aaaa4c7f7be358f85497cb3;p=ceph.git client: Add is_dir check before changing directory Fixes: https://tracker.ceph.com/issues/43440 Signed-off-by: Varsha Rao --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 06d71d3537a6f..ce99f0ef4ee98 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -9900,6 +9900,10 @@ int Client::chdir(const char *relpath, std::string &new_cwd, int r = path_walk(path, &in, perms); if (r < 0) return r; + + if (!(in.get()->is_dir())) + return -ENOTDIR; + if (cwd != in) cwd.swap(in); ldout(cct, 3) << "chdir(" << relpath << ") cwd now " << cwd->ino << dendl;