summaryrefslogtreecommitdiff
path: root/sysutils/prelink/files/patch-src-doit.c
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2013-02-21 00:50:10 +0000
committerMartin Wilke <miwi@FreeBSD.org>2013-02-21 00:50:10 +0000
commitca38a36b6d729c2881c03c38ecde4397b27c3710 (patch)
treeef6ab7ee88805ca16b5388d5e89e9aeddec66e48 /sysutils/prelink/files/patch-src-doit.c
parent- Update to 1.11 (diff)
ELF prelinking utility to speed up dynamic linking.
WWW: http://people.redhat.com/jakub/prelink/ PR: ports/176283 Submitted by: Damjan Jovanovic <damjan.jov@gmail.com>
Notes
Notes: svn path=/head/; revision=312689
Diffstat (limited to 'sysutils/prelink/files/patch-src-doit.c')
-rw-r--r--sysutils/prelink/files/patch-src-doit.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/sysutils/prelink/files/patch-src-doit.c b/sysutils/prelink/files/patch-src-doit.c
new file mode 100644
index 000000000000..0cd474116f2f
--- /dev/null
+++ b/sysutils/prelink/files/patch-src-doit.c
@@ -0,0 +1,70 @@
+diff -Nur src/doit.c src/doit.c
+--- src/doit.c 2013-02-19 23:54:34.000000000 +0200
++++ src/doit.c 2013-02-19 23:50:31.000000000 +0200
+@@ -16,7 +16,9 @@
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+ #include <config.h>
++#if HAVE_ALLOCA_H
+ #include <alloca.h>
++#endif
+ #include <errno.h>
+ #include <error.h>
+ #include <fcntl.h>
+@@ -51,7 +53,11 @@
+ {
+ int i, j;
+ DSO *dso;
++#if __LINUX__
+ struct stat64 st;
++#else
++ struct stat st;
++#endif
+ struct prelink_link *hardlink;
+ char *move = NULL;
+ size_t movelen = 0;
+@@ -109,7 +115,11 @@
+ if (dso == NULL)
+ goto error_out;
+
++#if __LINUX__
+ if (fstat64 (dso->fd, &st) < 0)
++#else
++ if (fstat (dso->fd, &st) < 0)
++#endif
+ {
+ error (0, errno, "%s changed during prelinking", ent->filename);
+ goto error_out;
+@@ -145,7 +155,11 @@
+ {
+ size_t len;
+
++#if __LINUX__
+ if (lstat64 (hardlink->canon_filename, &st) < 0)
++#else
++ if (lstat (hardlink->canon_filename, &st) < 0)
++#endif
+ {
+ error (0, 0, "Could not stat %s (former hardlink to %s)",
+ hardlink->canon_filename, ent->canon_filename);
+@@ -186,7 +200,7 @@
+ }
+ }
+
+- memcpy (mempcpy (move, hardlink->canon_filename, len), ".#prelink#",
++ memcpy (memcpy (move, hardlink->canon_filename, len) + len, ".#prelink#",
+ sizeof (".#prelink#"));
+ if (rename (hardlink->canon_filename, move) < 0)
+ {
+@@ -216,7 +230,11 @@
+ }
+ free (move);
+
++#if __LINUX__
+ if (! dry_run && stat64 (ent->canon_filename, &st) >= 0)
++#else
++ if (! dry_run && stat (ent->canon_filename, &st) >= 0)
++#endif
+ {
+ ent->dev = st.st_dev;
+ ent->ino = st.st_ino;