diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp index d79e4778e..f314fb0af 100644 --- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp @@ -44,14 +44,12 @@ bool UnsafeShowOpenWith(const QString &filepath) { const auto fd = open( QFile::encodeName(filepath).constData(), - O_RDONLY); + O_RDONLY | O_CLOEXEC); if (fd == -1) { return false; } - const auto fdGuard = gsl::finally([&] { close(fd); }); - const auto handleToken = "tdesktop" + std::to_string(base::RandomValue()); @@ -73,6 +71,7 @@ bool UnsafeShowOpenWith(const QString &filepath) { nullptr)); if (!request) { + close(fd); return false; } @@ -107,7 +106,7 @@ bool UnsafeShowOpenWith(const QString &filepath) { GLib::Variant::new_variant( GLib::Variant::new_boolean(true))), }), - Gio::UnixFDList::new_from_array((std::array{ fd }).data(), 1), + Gio::UnixFDList::new_from_array(&fd, 1), nullptr); if (!result) { diff --git a/Telegram/lib_base b/Telegram/lib_base index e2c62ef0b..4d56f8b4b 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit e2c62ef0b4581d84e4ff79623a7e5e9ed315bad7 +Subproject commit 4d56f8b4bba52b46844f46fafa5f9b6b2704429e