From 8dd5a6bf7417f435768c86bd8ca661f6815daf34 Mon Sep 17 00:00:00 2001 From: "j-h.choi" Date: Tue, 26 Oct 2021 15:57:10 +0900 Subject: [PATCH] Add chmod to change the permission of the file Change-Id: I56efe62379496138d2d197d24e8b061f8ea2f91a --- NativeLauncher/util/utils.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NativeLauncher/util/utils.cc b/NativeLauncher/util/utils.cc index fe50c38..6958529 100644 --- a/NativeLauncher/util/utils.cc +++ b/NativeLauncher/util/utils.cc @@ -424,10 +424,12 @@ void copySmackAndOwnership(const std::string& fromPath, const std::string& toPat free(label); } - // change owner and groups for symbolic link. + // change owner, groups and mode for symbolic link. if (!lstat(fromPath.c_str(), &info)) { if (lchown(toPath.c_str(), info.st_uid, info.st_gid) == -1) _SERR("Failed to change owner and group name"); + if (lchmod(toPath.c_str(), info.st_mode) == -1) + _SERR("Failed to change mode"); } } else { // change smack label @@ -438,10 +440,12 @@ void copySmackAndOwnership(const std::string& fromPath, const std::string& toPat free(label); } - // change owner and groups for generated ni file. + // change owner, groups and mode for generated ni file. if (!stat(fromPath.c_str(), &info)) { if (chown(toPath.c_str(), info.st_uid, info.st_gid) == -1) _SERR("Failed to change owner and group name"); + if (chmod(toPath.c_str(), info.st_mode) == -1) + _SERR("Failed to change mode"); } } } -- 2.7.4