cov 10381: check result of open()

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2824 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Angus Salkeld 2010-05-14 02:04:53 +00:00
parent 3ebd6fab52
commit b4f61842b6

View File

@ -1258,9 +1258,10 @@ static unsigned long rng_nix(unsigned char *buf, unsigned long len,
fd = open ("/dev/urandom", O_RDONLY);
rb = (unsigned long)read (fd, buf, len);
close (fd);
if (fd >= 0) {
rb = (unsigned long)read (fd, buf, len);
close (fd);
}
return (rb);
}