Remove useless access() before open()

This commit is contained in:
Frank Denis 2014-06-09 19:06:07 -07:00
parent befd9c257d
commit 3acdfa99a6
2 changed files with 2 additions and 4 deletions

View File

@ -119,8 +119,7 @@ randombytes_salsa20_random_random_dev_open(void)
int fd;
do {
if (access(*device, F_OK | R_OK) == 0 &&
(fd = open(*device, O_RDONLY)) != -1) {
if ((fd = open(*device, O_RDONLY)) != -1) {
if (fstat(fd, &st) == 0 && S_ISCHR(st.st_mode)) {
return fd;
}

View File

@ -111,8 +111,7 @@ randombytes_sysrandom_random_dev_open(void)
int fd;
do {
if (access(*device, F_OK | R_OK) == 0 &&
(fd = open(*device, O_RDONLY)) != -1) {
if ((fd = open(*device, O_RDONLY)) != -1) {
if (fstat(fd, &st) == 0 && S_ISCHR(st.st_mode)) {
return fd;
}