From 473b1e7218c201d0a6a08b20098b0782b3a57518 Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Fri, 29 May 2020 14:32:42 +0800 Subject: [PATCH] add function: fc_get_umask --- src/shared_func.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/shared_func.h b/src/shared_func.h index 1ca0551..251c47c 100644 --- a/src/shared_func.h +++ b/src/shared_func.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include "common_define.h" @@ -952,6 +953,16 @@ int fc_init_buffer(BufferInfo *buffer, const int buffer_size); */ void fc_free_buffer(BufferInfo *buffer); + +static inline int fc_get_umask() +{ + mode_t mode; + + mode = umask(0); //fetch + umask(mode); //restore + return mode; +} + #ifdef __cplusplus } #endif