--- glibc-2.3.4.orig/sysdeps/unix/sysv/linux/ssp.c 2005-02-19 09:32:15.493059952 +0100 +++ glibc-2.3.4/sysdeps/unix/sysv/linux/ssp.c 2005-02-19 09:36:59.006959288 +0100 @@ -46,6 +46,11 @@ unsigned long __guard = 0UL; +/* Use of __* functions from the rest of glibc here avoids + * initialisation problems for executables preloaded with + * libraries that overload the associated standard library + * functions. + */ void __guard_setup (void) { @@ -76,13 +81,13 @@ { int fd; #ifdef HAVE_DEV_ERANDOM - if ((fd = open ("/dev/erandom", O_RDONLY)) == (-1)) + if ((fd = __open ("/dev/erandom", O_RDONLY)) == (-1)) #endif - fd = open ("/dev/urandom", O_RDONLY); + fd = __open ("/dev/urandom", O_RDONLY); if (fd != (-1)) { - size = read (fd, (char *) &__guard, sizeof (__guard)); - close (fd); + size = __read (fd, (char *) &__guard, sizeof (__guard)); + __close (fd); if (size == sizeof (__guard)) return; } @@ -97,7 +102,7 @@ * terminator canary */ struct timeval tv; - gettimeofday (&tv, NULL); + __gettimeofday (&tv, NULL); __guard ^= tv.tv_usec ^ tv.tv_sec; } }