]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix Cppcheck warning about always false value
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 25 Aug 2019 09:29:17 +0000 (11:29 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 5 Sep 2019 20:04:43 +0000 (22:04 +0200)
src/util.cpp

index a826dc0945f7337158be476f810b2b9e8a94fe0e..f3d462b2e6fa429f57121779871eb975e13cf147 100644 (file)
@@ -391,10 +391,10 @@ get_umask(void)
 bool
 clone_file(const char* src, const char* dest, bool via_tmp_file)
 {
-  bool result;
-
 #ifdef FILE_CLONING_SUPPORTED
 
+  bool result;
+
 #  if defined(__linux__)
   int src_fd = open(src, O_RDONLY);
   if (src_fd == -1) {
@@ -440,17 +440,17 @@ clone_file(const char* src, const char* dest, bool via_tmp_file)
   result = clonefile(src, dest, CLONE_NOOWNERCOPY) == 0;
 #  endif
 
+  return result;
+
 #else // FILE_CLONING_SUPPORTED
 
   (void)src;
   (void)dest;
   (void)via_tmp_file;
   errno = EOPNOTSUPP;
-  result = false;
+  return false;
 
 #endif // FILE_CLONING_SUPPORTED
-
-  return result;
 }
 
 // Copy a file from src to dest. If via_tmp_file is true, the file is copied to