From 883d9b1e629ccad44df7b0f4b5e992a02b943898 Mon Sep 17 00:00:00 2001 From: liuchang0812 Date: Tue, 20 Dec 2016 13:40:09 +0800 Subject: [PATCH] client: fix clang warn of "argument is an uninitialized value" http://people.redhat.com/bhubbard/scan-build/report-faad49.html#EndPath Signed-off-by: liuchang0812 --- src/client/Client.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index a8dd3a2af57b..dea553ad17e2 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7130,7 +7130,9 @@ int Client::opendir(const char *relpath, dir_result_t **dirpp, const UserPerm& p return r; } r = _opendir(in.get(), dirpp, perms); - tout(cct) << (unsigned long)*dirpp << std::endl; + /* if ENOTDIR, dirpp will be an uninitialized point and it's very dangerous to access its value */ + if (r != -ENOTDIR) + tout(cct) << (unsigned long)*dirpp << std::endl; return r; } -- 2.47.3