projects
/
platform
/
core
/
dotnet
/
launcher.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
77e301a
)
Change the function name from updateAssemblyInfo() to copySmackAndOwnership()
author
j-h.choi
<j-h.choi@samsung.com>
Fri, 17 Jan 2020 02:04:17 +0000
(11:04 +0900)
committer
이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자
<leee.lee@samsung.com>
Thu, 6 Feb 2020 01:11:43 +0000
(10:11 +0900)
NativeLauncher/inc/utils.h
patch
|
blob
|
history
NativeLauncher/tool/ni_common.cc
patch
|
blob
|
history
NativeLauncher/tool/tac_common.cc
patch
|
blob
|
history
NativeLauncher/util/utils.cc
patch
|
blob
|
history
diff --git
a/NativeLauncher/inc/utils.h
b/NativeLauncher/inc/utils.h
index
c894c45
..
3e8c154
100644
(file)
--- a/
NativeLauncher/inc/utils.h
+++ b/
NativeLauncher/inc/utils.h
@@
-163,12
+163,12
@@
typedef std::function<void (const std::string&, const char*)> FileReader;
void scanFilesInDir(const std::string& directory, FileReader reader, unsigned int depth);
/**
void scanFilesInDir(const std::string& directory, FileReader reader, unsigned int depth);
/**
- * @brief
update assembly file info
.
+ * @brief
copy smack and ownership
.
* @param[in] get path
* @param[in] set path
* @param[in] symbolic link
*/
* @param[in] get path
* @param[in] set path
* @param[in] symbolic link
*/
-void
updateAssemblyInfo(const std::string& getPath, const std::string& set
Path, bool isSymlink = false);
+void
copySmackAndOwnership(const std::string& fromPath, const std::string& to
Path, bool isSymlink = false);
/**
* @brief create the new directory.
/**
* @brief create the new directory.
diff --git
a/NativeLauncher/tool/ni_common.cc
b/NativeLauncher/tool/ni_common.cc
index
6fc442f
..
2326722
100644
(file)
--- a/
NativeLauncher/tool/ni_common.cc
+++ b/
NativeLauncher/tool/ni_common.cc
@@
-112,7
+112,7
@@
static std::string getAppNIPath(const std::string& niPath)
if (!isFileExist(niDirPath)) {
if (mkdir(niDirPath.c_str(), 0755) == 0) {
if (!isFileExist(niDirPath)) {
if (mkdir(niDirPath.c_str(), 0755) == 0) {
-
updateAssemblyInfo
(prevPath, niDirPath);
+
copySmackAndOwnership
(prevPath, niDirPath);
} else {
fprintf(stderr, "Fail to create app ni directory (%s)\n", niDirPath.c_str());
}
} else {
fprintf(stderr, "Fail to create app ni directory (%s)\n", niDirPath.c_str());
}
@@
-267,7
+267,7
@@
static ni_error_e crossgen(const std::string& dllPath, const std::string& appPat
// Do not use niExist() function to check whether ni file created or not.
// niEixst() return false for System.Private.Corelib.dll
if (isFileExist(absNiPath)) {
// Do not use niExist() function to check whether ni file created or not.
// niEixst() return false for System.Private.Corelib.dll
if (isFileExist(absNiPath)) {
-
updateAssemblyInfo
(absDllPath, absNiPath);
+
copySmackAndOwnership
(absDllPath, absNiPath);
#ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
if (baseAddr != 0) {
updateBaseAddrFile(absNiPath, baseAddr);
#ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
if (baseAddr != 0) {
updateBaseAddrFile(absNiPath, baseAddr);
@@
-508,7
+508,7
@@
ni_error_e createTACPkgRoot(const std::string& pkgId, DWORD flags)
if (!bf::exists(symNIPath)) {
bf::create_symlink(originNiPath, symNIPath);
fprintf(stderr, "%s symbolic link file generated successfully.\n", symNIPath.c_str());
if (!bf::exists(symNIPath)) {
bf::create_symlink(originNiPath, symNIPath);
fprintf(stderr, "%s symbolic link file generated successfully.\n", symNIPath.c_str());
-
updateAssemblyInfo
(tacDir.c_str(), symNIPath.c_str(), true);
+
copySmackAndOwnership
(tacDir.c_str(), symNIPath.c_str(), true);
std::string NIFileName = symNIPath.substr(symNIPath.rfind('/') + 1);
if (!removeFile(concatPath(binNIDir, NIFileName))) {
std::string NIFileName = symNIPath.substr(symNIPath.rfind('/') + 1);
if (!removeFile(concatPath(binNIDir, NIFileName))) {
@@
-610,7
+610,7
@@
ni_error_e createNiDllUnderPkgRoot(const std::string& pkgId, const std::string&
if (!bf::exists(setNiPath)) {
bf::create_symlink(originNiPath, setNiPath);
fprintf(stderr, "%s symbolic link file generated successfully.\n", setNiPath.c_str());
if (!bf::exists(setNiPath)) {
bf::create_symlink(originNiPath, setNiPath);
fprintf(stderr, "%s symbolic link file generated successfully.\n", setNiPath.c_str());
-
updateAssemblyInfo
(tacDir.c_str(), setNiPath.c_str(), true);
+
copySmackAndOwnership
(tacDir.c_str(), setNiPath.c_str(), true);
}
}
}
}
}
}
diff --git
a/NativeLauncher/tool/tac_common.cc
b/NativeLauncher/tool/tac_common.cc
index
0c8df03
..
4c50abe
100644
(file)
--- a/
NativeLauncher/tool/tac_common.cc
+++ b/
NativeLauncher/tool/tac_common.cc
@@
-275,14
+275,14
@@
tac_error_e disableTACPackage(const std::string& pkgId)
fprintf(stderr, "Failed to copy of %s\n", dllPath.c_str());
return TAC_ERROR_UNKNOWN;
}
fprintf(stderr, "Failed to copy of %s\n", dllPath.c_str());
return TAC_ERROR_UNKNOWN;
}
-
updateAssemblyInfo
(binDir.c_str(), concatPath(binDir, fileName).c_str());
+
copySmackAndOwnership
(binDir.c_str(), concatPath(binDir, fileName).c_str());
} else {
std::string niPath = concatPath(binNIDir, fileName);
if (!copyFile(originPath, niPath)) {
fprintf(stderr, "Failed to copy of %s\n", niPath.c_str());
return TAC_ERROR_UNKNOWN;
}
} else {
std::string niPath = concatPath(binNIDir, fileName);
if (!copyFile(originPath, niPath)) {
fprintf(stderr, "Failed to copy of %s\n", niPath.c_str());
return TAC_ERROR_UNKNOWN;
}
-
updateAssemblyInfo
(binDir.c_str(), niPath.c_str());
+
copySmackAndOwnership
(binDir.c_str(), niPath.c_str());
}
}
}
}
}
}
@@
-329,7
+329,7
@@
tac_error_e enableTACPackage(const std::string& pkgId)
fprintf(stderr, "Cannot create directory: %s\n", tacDir.c_str());
return TAC_ERROR_UNKNOWN;
}
fprintf(stderr, "Cannot create directory: %s\n", tacDir.c_str());
return TAC_ERROR_UNKNOWN;
}
-
updateAssemblyInfo
(binDir.c_str(), tacDir.c_str());
+
copySmackAndOwnership
(binDir.c_str(), tacDir.c_str());
std::vector<std::string> enableNuget;
for (auto& npAssembly : depsJsonParser(rootPath, execName, getTPA())) {
std::vector<std::string> enableNuget;
for (auto& npAssembly : depsJsonParser(rootPath, execName, getTPA())) {
@@
-353,7
+353,7
@@
tac_error_e enableTACPackage(const std::string& pkgId)
if (bf::exists(originNIPath)) {
bf::create_symlink(originNIPath, concatPath(tacDir, NIFileName));
fprintf(stderr, "%s symbolic link file generated successfully.\n", concatPath(tacDir, NIFileName).c_str());
if (bf::exists(originNIPath)) {
bf::create_symlink(originNIPath, concatPath(tacDir, NIFileName));
fprintf(stderr, "%s symbolic link file generated successfully.\n", concatPath(tacDir, NIFileName).c_str());
-
updateAssemblyInfo
(tacDir.c_str(), concatPath(tacDir, NIFileName).c_str(), true);
+
copySmackAndOwnership
(tacDir.c_str(), concatPath(tacDir, NIFileName).c_str(), true);
if (!removeFile(concatPath(binNIDir, NIFileName))) {
fprintf(stderr, "Failed to remove of %s\n", concatPath(binNIDir, NIFileName).c_str());
if (!removeFile(concatPath(binNIDir, NIFileName))) {
fprintf(stderr, "Failed to remove of %s\n", concatPath(binNIDir, NIFileName).c_str());
@@
-363,7
+363,7
@@
tac_error_e enableTACPackage(const std::string& pkgId)
}
bf::create_symlink(originPath, concatPath(tacDir, fileName));
fprintf(stderr, "%s symbolic link file generated successfully.\n", concatPath(tacDir, fileName).c_str());
}
bf::create_symlink(originPath, concatPath(tacDir, fileName));
fprintf(stderr, "%s symbolic link file generated successfully.\n", concatPath(tacDir, fileName).c_str());
-
updateAssemblyInfo
(tacDir.c_str(), concatPath(tacDir, fileName).c_str(), true);
+
copySmackAndOwnership
(tacDir.c_str(), concatPath(tacDir, fileName).c_str(), true);
if (!removeFile(concatPath(binDir, fileName))) {
fprintf(stderr, "Failed to remove of %s\n", concatPath(binDir, fileName).c_str());
if (!removeFile(concatPath(binDir, fileName))) {
fprintf(stderr, "Failed to remove of %s\n", concatPath(binDir, fileName).c_str());
diff --git
a/NativeLauncher/util/utils.cc
b/NativeLauncher/util/utils.cc
index
c4df8b0
..
34c328d
100644
(file)
--- a/
NativeLauncher/util/utils.cc
+++ b/
NativeLauncher/util/utils.cc
@@
-350,37
+350,37
@@
void scanFilesInDir(const std::string& directory, FileReader reader, unsigned in
closedir(dir);
}
closedir(dir);
}
-void
updateAssemblyInfo(const std::string& getPath, const std::string& set
Path, bool isSymlink)
+void
copySmackAndOwnership(const std::string& fromPath, const std::string& to
Path, bool isSymlink)
{
char* label = NULL;
struct stat info;
if (isSymlink) {
// change smack label for symbolic link.
{
char* label = NULL;
struct stat info;
if (isSymlink) {
// change smack label for symbolic link.
- if (smack_lgetlabel(
get
Path.c_str(), &label, SMACK_LABEL_ACCESS) == 0) {
- if (smack_lsetlabel(
set
Path.c_str(), label, SMACK_LABEL_ACCESS) < 0) {
+ if (smack_lgetlabel(
from
Path.c_str(), &label, SMACK_LABEL_ACCESS) == 0) {
+ if (smack_lsetlabel(
to
Path.c_str(), label, SMACK_LABEL_ACCESS) < 0) {
fprintf(stderr, "Fail to set smack label\n");
}
free(label);
}
// change owner and groups for symbolic link.
fprintf(stderr, "Fail to set smack label\n");
}
free(label);
}
// change owner and groups for symbolic link.
- if (!stat(
get
Path.c_str(), &info)) {
- if (lchown(
set
Path.c_str(), info.st_uid, info.st_gid) == -1)
+ if (!stat(
from
Path.c_str(), &info)) {
+ if (lchown(
to
Path.c_str(), info.st_uid, info.st_gid) == -1)
fprintf(stderr, "Failed to change owner and group name\n");
}
} else {
// change smack label
fprintf(stderr, "Failed to change owner and group name\n");
}
} else {
// change smack label
- if (smack_getlabel(
get
Path.c_str(), &label, SMACK_LABEL_ACCESS) == 0) {
- if (smack_setlabel(
set
Path.c_str(), label, SMACK_LABEL_ACCESS) < 0) {
+ if (smack_getlabel(
from
Path.c_str(), &label, SMACK_LABEL_ACCESS) == 0) {
+ if (smack_setlabel(
to
Path.c_str(), label, SMACK_LABEL_ACCESS) < 0) {
fprintf(stderr, "Fail to set smack label\n");
}
free(label);
}
// change owner and groups for generated ni file.
fprintf(stderr, "Fail to set smack label\n");
}
free(label);
}
// change owner and groups for generated ni file.
- if (!stat(
get
Path.c_str(), &info)) {
- if (chown(
set
Path.c_str(), info.st_uid, info.st_gid) == -1)
+ if (!stat(
from
Path.c_str(), &info)) {
+ if (chown(
to
Path.c_str(), info.st_uid, info.st_gid) == -1)
fprintf(stderr, "Failed to change owner and group name\n");
}
}
fprintf(stderr, "Failed to change owner and group name\n");
}
}