This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Paul Pluzhnikov <paul@parasoft.com>] Re: libc/936: glibc2 - ld.so fails to load a program defining it's own strcmp()


>>>>> Ulrich Drepper writes:

Ulrich> Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:
>> I just got this email.  Paul seems to be right, his program doesn't
>> crash anymore since glibc's strcmp is always used.

Ulrich> The current behaviour is exactly how it has to be done.

Ok, I've rewritten the test program and it works now for me:
$ LD_LIBRARY_PATH=/usr/glibc/glibc-2.1/lib /usr/glibc/glibc-2.1/lib/ld-linux.so.2 ./crash 
there
here -1

Paul, I really think that's ok now.  What do you think?

Andreas


/* no need to even call strcmp -- ld.so will do that for you */
int strcmp(char *a, char *b)
{

    printf("there\n");
    while(*a && *b) {
	if (*a < *b) {
	    return -1;
	} else if (*a > *b) {
	    return 1;
	}
	a++; b++;
    }
    if (*a == '\0' && *b == '\0')
    	return 0;
    
    return *a < *b;
}

int
main()
{
    printf("here %d\n", strcmp ("a", "b"));
    return 0;
}


-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]