mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-26 11:47:13 +09:00
Remove useless access() before open()
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user