1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 20:46:37 +08:00

cmake: Tolerate nullptr from uv_default_loop

`uv_default_loop()` can return `nullptr` when running on a Linux kernel
configured without `CONFIG_EVENTFD`.

Fixes: #20899
This commit is contained in:
Brad King
2020-07-01 16:23:56 -04:00
parent 1e26c84b96
commit 0fddcc1e5b
2 changed files with 6 additions and 2 deletions

View File

@@ -823,7 +823,9 @@ void cmSystemTools::InitializeLibUV()
// Perform libuv one-time initialization now, and then un-do its
// global _fmode setting so that using libuv does not change the
// default file text/binary mode. See libuv issue 840.
uv_loop_close(uv_default_loop());
if (uv_loop_t* loop = uv_default_loop()) {
uv_loop_close(loop);
}
# ifdef _MSC_VER
_set_fmode(_O_TEXT);
# else

View File

@@ -717,6 +717,8 @@ int main(int ac, char const* const* av)
#ifndef CMAKE_BOOTSTRAP
cmDynamicLoader::FlushCache();
#endif
uv_loop_close(uv_default_loop());
if (uv_loop_t* loop = uv_default_loop()) {
uv_loop_close(loop);
}
return ret;
}