Skip to content

Commit

Permalink
fix setting empty rpath
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Sep 12, 2021
1 parent 57c3e7d commit de39018
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/patchelf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op,
debug("new rpath is '%s'\n", newRPath.c_str());


if (newRPath.size() <= rpathSize) {
if (rpath && newRPath.size() <= rpathSize) {
memcpy(rpath, newRPath.c_str(), newRPath.size() + 1);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ src_TESTS = \
no-gnu-hash.sh \
no-dynamic-section.sh \
args-from-file.sh \
basic-flags.sh
basic-flags.sh \
set-empty-rpath.sh

build_TESTS = \
$(no_rpath_arch_TESTS)
Expand Down
11 changes: 11 additions & 0 deletions tests/set-empty-rpath.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /bin/sh -e
SCRATCH=scratch/$(basename $0 .sh)

rm -rf ${SCRATCH}
mkdir -p ${SCRATCH}

cp simple ${SCRATCH}/simple

../src/patchelf --force-rpath --set-rpath "" ${SCRATCH}/simple

${SCRATCH}/simple

0 comments on commit de39018

Please sign in to comment.