check return value of RAND_pseudo_bytes; backport from the stable branch