From b82db8764c7c5ed122b83f2a25f9926221c27de3 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 31 Mar 2012 17:08:52 +0000 Subject: [PATCH] only pull entropy from glibc pointer guard if glibc is actually there --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index f90a8a5..9791b5a 100644 --- a/main.c +++ b/main.c @@ -34,7 +34,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.212 2012/03/27 22:36:52 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.213 2012/03/31 17:08:52 tg Exp $"); extern char **environ; @@ -109,7 +109,9 @@ rndsetup(void) struct { ALLOC_ITEM alloc_INT; void *dataptr, *stkptr, *mallocptr; +#if defined(__GLIBC__) && (__GLIBC__ >= 2) sigjmp_buf jbuf; +#endif struct timeval tv; } *bufptr; char *cp; @@ -127,8 +129,10 @@ rndsetup(void) bufptr->stkptr = &bufptr; /* randomised malloc in BSD (and possibly others) */ bufptr->mallocptr = bufptr; +#if defined(__GLIBC__) && (__GLIBC__ >= 2) /* glibc pointer guard */ sigsetjmp(bufptr->jbuf, 1); +#endif /* introduce variation (and yes, second arg MBZ for portability) */ gettimeofday(&bufptr->tv, NULL);