From 3acdfa99a6922a1f4eed699f301131ae98820c2d Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 9 Jun 2014 19:06:07 -0700 Subject: [PATCH] Remove useless access() before open() --- src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c | 3 +-- src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c index 61f9e855..970ce750 100644 --- a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +++ b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c @@ -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; } diff --git a/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c b/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c index f38c681f..efb7dbef 100644 --- a/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +++ b/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c @@ -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; }