diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-11 13:42:54 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-11 13:45:20 +0000 |
commit | a28c145aa40b4b29dc1f2b5db44ffc187fcd3f21 (patch) | |
tree | a597d6ab1e85dc44e68c8d297461be992300107d /meta/recipes-devtools/patchelf | |
parent | 6c9e94f3186a06eb00c7e0b72f603e90fe9b0f41 (diff) | |
download | poky-a28c145aa40b4b29dc1f2b5db44ffc187fcd3f21.tar.gz |
patchelf: Fix corrupted file mode patchuninative-3.5
The recent patchelf upgrades corrupted the file permissions patch we
carry as upstream inserted an early exit to the funciton.
This showed up as corrupted file modes when testing a new uninative tarball
containing this patchelf.
Rework and tweak the patch to fix this.
(From OE-Core rev: bcdba091d99f9a3ae67c0ba17fcf27329698a0c0)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/patchelf')
-rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch | 36 |
1 files changed, 23 insertions, 13 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 8d9a50a697..b755a263a4 100644 --- a/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch +++ b/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch | |||
@@ -14,11 +14,11 @@ Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br> | |||
14 | src/patchelf.cc | 16 +++++++++++++++- | 14 | src/patchelf.cc | 16 +++++++++++++++- |
15 | 1 file changed, 15 insertions(+), 1 deletion(-) | 15 | 1 file changed, 15 insertions(+), 1 deletion(-) |
16 | 16 | ||
17 | diff --git a/src/patchelf.cc b/src/patchelf.cc | 17 | Index: git/src/patchelf.cc |
18 | index 1aeae88..6b77afe 100644 | 18 | =================================================================== |
19 | --- a/src/patchelf.cc | 19 | --- git.orig/src/patchelf.cc |
20 | +++ b/src/patchelf.cc | 20 | +++ git/src/patchelf.cc |
21 | @@ -534,9 +534,19 @@ void ElfFile<ElfFileParamNames>::sortShdrs() | 21 | @@ -534,9 +534,19 @@ void ElfFile<ElfFileParamNames>::sortShd |
22 | 22 | ||
23 | static void writeFile(const std::string & fileName, const FileContents & contents) | 23 | static void writeFile(const std::string & fileName, const FileContents & contents) |
24 | { | 24 | { |
@@ -39,17 +39,27 @@ index 1aeae88..6b77afe 100644 | |||
39 | if (fd == -1) | 39 | if (fd == -1) |
40 | error("open"); | 40 | error("open"); |
41 | 41 | ||
42 | @@ -564,6 +574,10 @@ static void writeFile(const std::string & fileName, const FileContents & content | 42 | @@ -551,8 +561,6 @@ static void writeFile(const std::string |
43 | if (errno == EINTR) | 43 | bytesWritten += portion; |
44 | return; | 44 | } |
45 | error("close"); | 45 | |
46 | - if (close(fd) >= 0) | ||
47 | - return; | ||
48 | /* | ||
49 | * Just ignore EINTR; a retry loop is the wrong thing to do. | ||
50 | * | ||
51 | @@ -561,9 +569,11 @@ static void writeFile(const std::string | ||
52 | * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR | ||
53 | * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain | ||
54 | */ | ||
55 | - if (errno == EINTR) | ||
56 | - return; | ||
57 | - error("close"); | ||
58 | + if ((close(fd) < 0) && errno != EINTR) | ||
59 | + error("close"); | ||
46 | + | 60 | + |
47 | + if (chmod(fileName.c_str(), st.st_mode) != 0) | 61 | + if (chmod(fileName.c_str(), st.st_mode) != 0) |
48 | + error("chmod"); | 62 | + error("chmod"); |
49 | + | ||
50 | } | 63 | } |
51 | 64 | ||
52 | 65 | ||
53 | -- | ||
54 | 2.25.1 | ||
55 | |||