From: j-h.choi Date: Tue, 26 Oct 2021 06:57:10 +0000 (+0900) Subject: Add chmod to change the permission of the file X-Git-Tag: accepted/tizen/unified/20220110.054933~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8dd5a6bf7417f435768c86bd8ca661f6815daf34;p=platform%2Fcore%2Fdotnet%2Flauncher.git Add chmod to change the permission of the file Change-Id: I56efe62379496138d2d197d24e8b061f8ea2f91a --- 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"); } } }