diff --git a/src/appspawn_server.cpp b/src/appspawn_server.cpp index 2acb6818de5f3490b45fa2d15eeef9673baaed39..ea25bbdbfadde20709936a1732c51143bc69b64d 100644 --- a/src/appspawn_server.cpp +++ b/src/appspawn_server.cpp @@ -42,6 +42,8 @@ constexpr int32_t WAIT_DELAY_US = 100 * 1000; // 100ms constexpr int32_t GID_MEDIA = 1023; constexpr int32_t MAX_GIDS = 64; +constexpr mode_t APP_DEFAULT_MASK = 0002; + constexpr std::string_view BUNDLE_NAME_CAMERA("com.ohos.camera"); constexpr std::string_view BUNDLE_NAME_PHOTOS("com.ohos.photos"); constexpr std::string_view BUNDLE_NAME_MEDIA_LIBRARY("com.ohos.medialibrary.MediaLibraryDataA"); @@ -55,6 +57,11 @@ static constexpr HiLogLabel LABEL = {LOG_CORE, 0, "AppSpawnServer"}; extern "C" { #endif +static void SetUmask() +{ + umask(APP_DEFAULT_MASK); +} + static void SignalHandler([[maybe_unused]] int sig) { pid_t pid; @@ -422,6 +429,8 @@ bool AppSpawnServer::SetAppProcProperty(int connectFd, const ClientSocket::AppPr } #endif + SetUmask(); + ret = SetFileDescriptors(); if (FAILED(ret)) { NotifyResToParentProc(fd[1], ret);