Package: patchelf
Version: 0.8-2
Patchelf breaks hardlinks. The attached patch will fix that.
See also: https://github.com/NixOS/patchelf/issues/32
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -360,19 +360,10 @@
static void writeFile(string fileName, mode_t fileMode)
{
-string fileName2 = fileName + _patchelf_tmp;
-
-int fd = open(fileName2.c_str(),
-O_CREAT | O_TRUNC | O_WRONLY, 0700);
+int fd = open(fileName.c_str(), O_TRUNC | O_WRONLY);
if (fd == -1) error(open);
-
if (write(fd, contents, fileSize) != fileSize) error(write);
-
if (close(fd) != 0) error(close);
-
-if (chmod(fileName2.c_str(), fileMode) != 0) error(chmod);
-
-if (rename(fileName2.c_str(), fileName.c_str()) != 0) error(rename);
}
@@ -1122,7 +1113,7 @@
if (elfFile.isChanged()){
elfFile.rewriteSections();
-writeFile(fileName, fileMode);
+writeFile(fileName);
}
}