aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-06-14 16:41:10 -0500
committerMark Hatle <mark.hatle@windriver.com>2010-07-22 17:54:57 -0500
commit3582de845f8bb88fba6a7139403e731b5015fb1b (patch)
tree3ff5f41dcbe8ffecfa7e1ebf2333f9332716abbe
parente2b46a6b44e3d5e634298aedcaa2fb1fea6d9142 (diff)
downloadprelink-cross-3582de845f8bb88fba6a7139403e731b5015fb1b.tar.gz
prelink-cross-3582de845f8bb88fba6a7139403e731b5015fb1b.tar.bz2
prelink-cross-3582de845f8bb88fba6a7139403e731b5015fb1b.zip
Merge to r150
2006-11-28 Mark Shinwell <shinwell@codesourcery.com> * src/canonicalize.c: Add prelink.h include directive. Use wrap_readlink and wrap_lstat64. * src/prelink.h: Declare wrap_readlink. * src/wrap-file.c (wrap_readlink): New.
-rw-r--r--trunk/ChangeLog.cross7
-rw-r--r--trunk/src/canonicalize.c7
-rw-r--r--trunk/src/prelink.h1
-rw-r--r--trunk/src/wrap-file.c17
4 files changed, 29 insertions, 3 deletions
diff --git a/trunk/ChangeLog.cross b/trunk/ChangeLog.cross
index 52206ff..0427584 100644
--- a/trunk/ChangeLog.cross
+++ b/trunk/ChangeLog.cross
@@ -2,6 +2,13 @@
* Integrate prelinker/cross-prelinking patches
+ 2006-11-28 Mark Shinwell <shinwell@codesourcery.com>
+
+ * src/canonicalize.c: Add prelink.h include directive.
+ Use wrap_readlink and wrap_lstat64.
+ * src/prelink.h: Declare wrap_readlink.
+ * src/wrap-file.c (wrap_readlink): New.
+
2006-10-13 Daniel Jacobowitz <dan@codesourcery.com>
* src/execle_open.c (execve_open): Add an error message if execve
diff --git a/trunk/src/canonicalize.c b/trunk/src/canonicalize.c
index 79df44e..c51b277 100644
--- a/trunk/src/canonicalize.c
+++ b/trunk/src/canonicalize.c
@@ -28,6 +28,7 @@
#include <stddef.h>
#include "hashtab.h"
+#include "prelink.h"
htab_t prelink_dirname_htab;
@@ -241,7 +242,7 @@ canon_filename (const char *name, int nested, struct stat64 *stp)
dest = mempcpy (dest, start, end - start);
*dest = '\0';
- if (lstat64 (rpath, stp) < 0)
+ if (wrap_lstat64 (rpath, stp) < 0)
goto error;
stp_initialized = 1;
@@ -257,7 +258,7 @@ canon_filename (const char *name, int nested, struct stat64 *stp)
goto error;
}
- n = readlink (rpath, buf, path_max);
+ n = wrap_readlink (rpath, buf, path_max);
if (n < 0)
goto error;
buf[n] = '\0';
@@ -294,7 +295,7 @@ canon_filename (const char *name, int nested, struct stat64 *stp)
--dest;
*dest = '\0';
- if (!stp_initialized && lstat64 (rpath, stp) < 0)
+ if (!stp_initialized && wrap_lstat64 (rpath, stp) < 0)
goto error;
if (dest + 1 - rpath <= (rpath_limit - rpath) / 2)
diff --git a/trunk/src/prelink.h b/trunk/src/prelink.h
index 0118602..eb0975c 100644
--- a/trunk/src/prelink.h
+++ b/trunk/src/prelink.h
@@ -510,6 +510,7 @@ extern GElf_Addr mmap_reg_start, mmap_reg_end;
extern const char *sysroot;
char *wrap_prelink_canonicalize (const char *name, struct stat64 *stp);
+int wrap_readlink (const char *path, char *buf, int len);
int wrap_lstat64 (const char *file, struct stat64 *buf);
int wrap_stat64 (const char *file, struct stat64 *buf);
int wrap_open (const char *file, int mode, ...);
diff --git a/trunk/src/wrap-file.c b/trunk/src/wrap-file.c
index c631458..0f7120c 100644
--- a/trunk/src/wrap-file.c
+++ b/trunk/src/wrap-file.c
@@ -534,3 +534,20 @@ wrap_unlink (const char *filename)
free (tmpname);
return ret;
}
+
+int
+wrap_readlink (const char *path, char *buf, int len)
+{
+ char *tmpname = sysroot_file_name (path, 1, NULL);
+ int ret;
+
+ if (tmpname == NULL)
+ return -1;
+
+ ret = readlink (tmpname, buf, len);
+
+ if (tmpname != path)
+ free (tmpname);
+ return ret;
+}
+