diff options
Diffstat (limited to 'meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch')
-rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch b/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch index 03b0d18a89..63080a42d4 100644 --- a/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch +++ b/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch @@ -1,4 +1,4 @@ -From 7f1fd10cfebd5ea2f3e1938abe1bd1c4828164a7 Mon Sep 17 00:00:00 2001 +From 682fb48c137b687477008b68863c2a0b73ed47d1 Mon Sep 17 00:00:00 2001 From: Fabio Berton <fabio.berton@ossystems.com.br> Date: Fri, 9 Sep 2016 16:00:42 -0300 Subject: [PATCH] handle read-only files @@ -15,29 +15,31 @@ Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br> 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/patchelf.cc b/src/patchelf.cc -index 0b4965adff83..b5db2aef0e8a 100644 +index fd1e7b7..a941da1 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc -@@ -497,7 +497,17 @@ void ElfFile<ElfFileParamNames>::sortShdrs() +@@ -527,9 +527,19 @@ void ElfFile<ElfFileParamNames>::sortShdrs() - static void writeFile(std::string fileName, FileContents contents) + static void writeFile(const std::string & fileName, const FileContents & contents) { -- int fd = open(fileName.c_str(), O_TRUNC | O_WRONLY); + struct stat st; + int fd; + + debug("writing %s\n", fileName.c_str()); + +- int fd = open(fileName.c_str(), O_CREAT | O_TRUNC | O_WRONLY, 0777); + if (stat(fileName.c_str(), &st) != 0) + error("stat"); + + if (chmod(fileName.c_str(), 0600) != 0) + error("chmod"); + -+ fd = open(fileName.c_str(), O_TRUNC | O_WRONLY); ++ fd = open(fileName.c_str(), O_CREAT | O_TRUNC | O_WRONLY, 0777); + if (fd == -1) error("open"); -@@ -511,6 +521,10 @@ static void writeFile(std::string fileName, FileContents contents) +@@ -543,6 +553,10 @@ static void writeFile(const std::string & fileName, const FileContents & content if (close(fd) != 0) error("close"); |