mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-16 09:52:31 +00:00
Fix logging implementation
- Block signals in logging routine (fix #3976) - Prevent possible deadlock after fork (stdio locks internally) by creating a new FILE pointer per logging call (thread/stack local)
This commit is contained in:
@@ -8,7 +8,12 @@
|
||||
#define UID_ROOT 0
|
||||
#define UID_SHELL 2000
|
||||
|
||||
#define DISALLOW_COPY_AND_MOVE(clazz) \
|
||||
clazz(const clazz &) = delete; \
|
||||
clazz(clazz &&) = delete;
|
||||
|
||||
class mutex_guard {
|
||||
DISALLOW_COPY_AND_MOVE(mutex_guard)
|
||||
public:
|
||||
explicit mutex_guard(pthread_mutex_t &m): mutex(&m) {
|
||||
pthread_mutex_lock(mutex);
|
||||
@@ -26,6 +31,7 @@ private:
|
||||
|
||||
template <class Func>
|
||||
class run_finally {
|
||||
DISALLOW_COPY_AND_MOVE(run_finally)
|
||||
public:
|
||||
explicit run_finally(const Func &fn) : fn(fn) {}
|
||||
~run_finally() { fn(); }
|
||||
|
Reference in New Issue
Block a user