config: Fix 'warn_unused_result' during build

tools/Config.cpp: In member function 'virtual int Config::main(const std::vector<std::basic_string<char> >&)':
tools/Config.cpp:480:18: error: ignoring return value of 'int chown(const char*, __uid_t, __gid_t)' declared with attribute 'warn_unused_result' [-Werror=unused-result]
  480 |             chown(proofKeyPath.c_str(), pwd->pw_uid, -1);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From fc946198d3

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Iaa4db6fb4dc6f742779754d4e05708aa8f41ebd6
pull/6961/head
Aron Budea 2023-07-23 05:20:58 +02:00 committed by thebearon
parent fc946198d3
commit f84835b0c6
1 changed files with 3 additions and 1 deletions

View File

@ -477,7 +477,9 @@ int Config::main(const std::vector<std::string>& args)
proofKey.save(proofKeyPath + ".pub", proofKeyPath, "" /*no password*/);
#if !ENABLE_DEBUG
chmod(proofKeyPath.c_str(), S_IRUSR | S_IWUSR);
chown(proofKeyPath.c_str(), pwd->pw_uid, -1);
const int ChResult = chown(proofKeyPath.c_str(), pwd->pw_uid, -1);
if (ChResult != 0)
std::cerr << "Changing owner of " + proofKeyPath + " failed." << std::endl;
#endif
}
else