kit/Kit.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
New commits: commit 3bbbc4f2af97554df91377ac696a9a9224166c16 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Sat Apr 25 10:06:03 2020 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat Apr 25 14:58:18 2020 +0200 Kit: remove redundant FILE wrapper around the fd. Change-Id: I76f00a6855c486c18fb18fbcefe93ba0072a6eea Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92890 Reviewed-by: Gabriel Masei <gabriel.ma...@1and1.ro> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 8cd62f43b..46eaf55c9 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -650,7 +650,7 @@ public: }; #if !MOBILEAPP -static FILE* ProcSMapsFile = nullptr; +static int ProcSMapsFile = -1; #endif class ThreadPool { @@ -796,14 +796,14 @@ public: assert(_loKit); #if !MOBILEAPP - if (ProcSMapsFile) + if (ProcSMapsFile >= 0) { static const std::string str = "smapsfd:"; - if (websocketHandler->sendTextMessageWithFD(str.c_str(), str.size(), ProcSMapsFile->_fileno) > 0) + if (websocketHandler->sendTextMessageWithFD(str.c_str(), str.size(), ProcSMapsFile) > 0) { LOG_DBG("Successfully sent smaps fd to wsd"); - fclose(ProcSMapsFile); - ProcSMapsFile = nullptr; + close(ProcSMapsFile); + ProcSMapsFile = -1; } else { @@ -2601,11 +2601,9 @@ void lokit_main( LOG_SYS("mknod(" << jailPath.toString() << "/dev/random) failed. Mount must not use nodev flag."); } - ProcSMapsFile = fopen("/proc/self/smaps", "r"); - if (ProcSMapsFile == nullptr) - { - LOG_SYS("Failed to symlink /proc/self/smaps. Memory stats will be missing."); - } + ProcSMapsFile = open("/proc/self/smaps", O_RDONLY); + if (ProcSMapsFile < 0) + LOG_SYS("Failed to open /proc/self/smaps. Memory stats will be missing."); LOG_INF("chroot(\"" << jailPath.toString() << "\")"); if (chroot(jailPath.toString().c_str()) == -1) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits