From: Joel Rosdahl Date: Sun, 25 Aug 2019 09:29:17 +0000 (+0200) Subject: Fix Cppcheck warning about always false value X-Git-Tag: v4.0~809 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef36fa77c45d012b421e44d2e0fc1cf7c8daf2c0;p=thirdparty%2Fccache.git Fix Cppcheck warning about always false value --- diff --git a/src/util.cpp b/src/util.cpp index a826dc094..f3d462b2e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -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