diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-23 13:16:39 (GMT) |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-23 13:16:39 (GMT) |
commit | 90371dac828a4e264adaf2e19bfe2ad1cfc019c1 (patch) | |
tree | fee809bc263c621d17eca67f8e6250ce25cf6f42 | |
parent | 514e54cabdac005f07c1adf2ccef3a87f2903a76 (diff) | |
download | patchelf-90371dac828a4e264adaf2e19bfe2ad1cfc019c1.zip patchelf-90371dac828a4e264adaf2e19bfe2ad1cfc019c1.tar.gz patchelf-90371dac828a4e264adaf2e19bfe2ad1cfc019c1.tar.bz2 |
* Don't remove non-absolute paths from the RPATH like "$ORIGIN".
-rw-r--r-- | patchelf.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -173,6 +173,13 @@ static void setInterpreter(void) } +static void concat(char * dst, char * src) +{ + if (*dst) strcat(dst, ":"); + strcat(dst, src); +} + + static void shrinkRPath(void) { /* Shrink the RPATH. */ @@ -254,7 +261,13 @@ static void shrinkRPath(void) dirName[end - pos] = 0; if (*end == ':') ++end; pos = end; - if (*dirName != '/') continue; + + /* Non-absolute entries are allowed (e.g., the special + "$ORIGIN" hack). */ + if (*dirName != '/') { + concat(newRPath, dirName); + continue; + } /* For each library that we haven't found yet, see if it exists in this directory. */ @@ -275,11 +288,8 @@ static void shrinkRPath(void) if (!libFound) fprintf(stderr, "removing directory `%s' from RPATH\n", dirName); - else { - if (*newRPath) strcat(newRPath, ":"); - strcat(newRPath, dirName); - } - + else + concat(newRPath, dirName); } if (strcmp(rpath, newRPath) != 0) { |