Skip to content

Commit 411e004

Browse files
Mic92haampie
authored andcommitted
fix setting empty rpath
1 parent 31e9c71 commit 411e004

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/patchelf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
14791479
debug("new rpath is '%s'\n", newRPath.c_str());
14801480

14811481

1482-
if (newRPath.size() <= rpathSize) {
1482+
if (rpath && newRPath.size() <= rpathSize) {
14831483
memcpy(rpath, newRPath.c_str(), newRPath.size() + 1);
14841484
return;
14851485
}

tests/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ src_TESTS = \
3131
invalid-elf.sh \
3232
endianness.sh \
3333
contiguous_note_sections.sh \
34-
no-gnu-hash.sh
34+
no-gnu-hash.sh \
35+
set-empty-rpath.sh
3536

3637
build_TESTS = \
3738
$(no_rpath_arch_TESTS)

tests/set-empty-rpath.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#! /bin/sh -e
2+
SCRATCH=scratch/$(basename $0 .sh)
3+
4+
rm -rf ${SCRATCH}
5+
mkdir -p ${SCRATCH}
6+
7+
cp simple ${SCRATCH}/simple
8+
9+
../src/patchelf --force-rpath --set-rpath "" ${SCRATCH}/simple
10+
11+
${SCRATCH}/simple

0 commit comments

Comments
 (0)