]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
code_environment.cc: move variable ret in get_process_name()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 27 Feb 2013 16:50:45 +0000 (17:50 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 27 Feb 2013 16:50:45 +0000 (17:50 +0100)
Move 'ret' in get_process_name() to the correct block to suppress
warning about unused variable in cppcheck.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/common/code_environment.cc

index 58b27f860493621c97e973f24ffe5440bb5e571e..2cf19f48bc575bb02044ffd1b5bc72b357830865 100644 (file)
@@ -47,7 +47,6 @@ std::ostream &operator<<(std::ostream &oss, enum code_environment_t e)
 
 int get_process_name(char *buf, int len)
 {
-  int ret;
   if (len <= 16) {
     /* The man page discourages using this prctl with a buffer shorter
      * than 16 bytes. With a 16-byte buffer, it might not be
@@ -59,6 +58,7 @@ int get_process_name(char *buf, int len)
     return -ENAMETOOLONG;
 #else
   memset(buf, 0, len);
+  int ret;
   ret = prctl(PR_GET_NAME, buf);
   return ret;
 #endif