]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix clang warn of "argument is an uninitialized value" 12580/head
authorliuchang0812 <liuchang0812@gmail.com>
Tue, 20 Dec 2016 05:40:09 +0000 (13:40 +0800)
committerliuchang0812 <liuchang0812@gmail.com>
Tue, 20 Dec 2016 05:40:09 +0000 (13:40 +0800)
http://people.redhat.com/bhubbard/scan-build/report-faad49.html#EndPath

Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
src/client/Client.cc

index a8dd3a2af57b81db80a3871026131bcc94d32d74..dea553ad17e27a61003fcb6675131fb45616cb58 100644 (file)
@@ -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;
 }