Don't use sysopen() and sysread() when it doesn't make sense.
Especially avoid using sysread() -- sysopen() can be used with read();
the C fdopen() is implicit.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
my $rfd, $rnd;
my $rid;
- if (sysopen($rfd, '/dev/urandom', O_RDONLY) &&
- sysread($rfd, $rnd, 4) == 4) {
+ if (open($rfd, "< /dev/urandom\0") && read($rfd, $rnd, 4) == 4) {
$rid = unpack("V", $rnd);
}
my $rfd, $rnd;
my $rid;
- if (sysopen($rfd, '/dev/urandom', O_RDONLY) &&
- sysread($rfd, $rnd, 4) == 4) {
+ if (open($rfd, "< /dev/urandom\0") && read($rfd, $rnd, 4) == 4) {
$rid = unpack("V", $rnd);
}