Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > f601522febf3212a1e0336668b84fadb > files > 4

ortp-0.16.1-4mdv2010.1.src.rpm

---
 src/stun.c |    8 	7 +	1 -	0 !
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: ortp-0.15.0/src/stun.c
===================================================================
--- ortp-0.15.0.orig/src/stun.c	2009-01-12 11:24:54.000000000 -0500
+++ ortp-0.15.0/src/stun.c	2009-08-07 10:07:45.000000000 -0400
@@ -1110,6 +1110,7 @@ stunRand(void)
 	int maxFd=0;
 	struct timeval tv;
 	int e;
+	ssize_t n;
 
         int fd=open("/dev/random",O_RDONLY);
 
@@ -1132,7 +1133,12 @@ stunRand(void)
            closesocket(fd);
 	   return random();
 	}
-	read(fd,&tick,sizeof(tick));
+	n = read(fd,&tick,sizeof(tick));
+	if (n <= 0) {
+           ortp_error("stun: Failed to get data from random device\n");
+           closesocket(fd);
+	   return random();
+	}
 	closesocket(fd);
       }
 #else