[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: installwatch.so: undefined symbol $$dyncall and a quick fix



Oh yes, those instructions also gave me a compile error, that _init()
was redefined:

/tmp/ccnVUjtK.o(.text+0x0): In function `_init':
: multiple definition of `_init'
/usr/lib/gcc-lib/hppa-linux/3.3.5/../../../crti.o(.init+0x0):/home/jbailey/glibc/sid/glibc-2.3.2.ds1/build-tree/hppa-libc/csu/crti.S:13: first defined here

A quick fix to this is to initialize at the start of each overridden function
if initialization has not yet been done. I'm sure there is a much better
way to do this, but in case it might be of help to anyone I've attached at
patch to installwatch.c that does this.

-- 
Chris Frost  |  <http://www.frostnet.net/chris/>
-------------+----------------------------------
Public PGP Key:
   Email chris@frostnet.net with the subject "retrieve pgp key"
   or visit <http://www.frostnet.net/chris/about/pgp_key.phtml>
--- installwatch-0.6.3/installwatch.c	2006-03-11 13:21:21.000000000 -0800
+++ installwatch-0.6.3_init/installwatch.c	2006-03-11 13:22:34.000000000 -0800
@@ -52,7 +52,7 @@
 #define REFCOUNT __installwatch_refcount++
 #define TIMECOUNT __installwatch_timecount++
 
-static time_t (*true_time) (time_t *);
+static time_t (*true_time) (time_t *) = NULL;
 static int(*true_chmod)(const char *, mode_t);
 static int(*true_chown)(const char *, uid_t, gid_t);
 static int(*true_chroot)(const char *);
@@ -89,8 +89,11 @@
 #endif /* defined __GNUC__ */
 ;
 
-void _init(void) {
+void do_init(void) {
 
+	if (true_time)
+		return;
+	
 	void *libc_handle;
 
 	#ifdef BROKEN_RTLD_NEXT
@@ -159,6 +162,7 @@
 }
 
 char * canonicalize(const char *path) {
+	do_init();
 #if defined(MAXPATHLEN)
 	char *resolved_path = malloc (MAXPATHLEN);
 	if (!resolved_path)
@@ -392,6 +396,7 @@
 }
 
 time_t time (time_t *timer) {
+	do_init();
 	TIMECOUNT;
 
 #if DEBUG
@@ -405,6 +410,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(path);
 	
@@ -422,6 +428,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(path);
 
@@ -439,6 +446,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(path);
 	result = true_chroot(path);
@@ -453,6 +461,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(pathname);
 
@@ -470,6 +479,7 @@
 int fchmod(int filedes, mode_t mode) {
 	int result;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -484,6 +494,7 @@
 int fchown(int fd, uid_t owner, gid_t group) {
 	int result;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -499,6 +510,7 @@
 	FILE *result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(pathname);
 
@@ -517,6 +529,7 @@
 int ftruncate(int fd, TRUNCATE_T length) {
 	int result;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -533,6 +546,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -551,6 +565,7 @@
 	int result;
 	char *old_canonic, *new_canonic;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -568,6 +583,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(pathname);
 	result = true_mkdir(pathname, mode);
@@ -582,6 +598,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	va_start(ap, flags);
 	mode = va_arg(ap, mode_t);
@@ -604,6 +621,7 @@
 	int result;
 	char *old_canonic, *new_canonic;
 
+	do_init();
 	REFCOUNT;
 	old_canonic = canonicalize(oldpath);
 
@@ -622,6 +640,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(pathname);
 
@@ -639,6 +658,7 @@
 	int result;
 	char *old_canonic, *new_canonic;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -656,6 +676,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -675,6 +696,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(pathname);
 
@@ -695,6 +717,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(pathname);
 
@@ -711,6 +734,7 @@
 int ftruncate64(int fd, __off64_t length) {
 	int result;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -726,6 +750,7 @@
 	FILE *result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 	canonic = canonicalize(pathname);
 
@@ -748,6 +773,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG
@@ -770,6 +796,7 @@
 	int result;
 	char *canonic;
 
+	do_init();
 	REFCOUNT;
 
 #if DEBUG

Reply to: