File tree Expand file tree Collapse file tree 1 file changed +2
-23
lines changed Expand file tree Collapse file tree 1 file changed +2
-23
lines changed Original file line number Diff line number Diff line change 24
24
#include <sys/eventfd.h>
25
25
#include <sys/signalfd.h>
26
26
#include <sys/stat.h>
27
+ #include <sys/random.h>
27
28
#include <sys/socket.h>
28
29
#include <sys/types.h>
29
30
#include <inttypes.h>
@@ -550,28 +551,6 @@ kexpectedpad_sha256_rsa2048[BFDEV_SHA256_DIGEST_SIZE] = {
550
551
static int
551
552
service_sync_write (struct sdbd_service * service , void * data , size_t length );
552
553
553
- static ssize_t
554
- path_read (const char * path , char * buff , size_t size )
555
- {
556
- ssize_t length ;
557
- int fd ;
558
-
559
- fd = open (path , O_RDONLY );
560
- if (bfdev_unlikely (fd < 0 )) {
561
- bfdev_log_err ("path read: failed to open file" );
562
- return - BFDEV_EACCES ;
563
- }
564
-
565
- length = read (fd , buff , size );
566
- if (bfdev_unlikely (length <= 0 )) {
567
- bfdev_log_err ("path read: failed to open file" );
568
- return - BFDEV_EFAULT ;
569
- }
570
-
571
- close (fd );
572
- return length ;
573
- }
574
-
575
554
static int
576
555
sdbd_read (int fd , void * data , size_t size )
577
556
{
@@ -3374,7 +3353,7 @@ sdbd(void)
3374
3353
}
3375
3354
}
3376
3355
3377
- retval = path_read ( "/dev/random" , ( void * ) & seed , sizeof (seed ));
3356
+ retval = getrandom ( & seed , sizeof (seed ), GRND_RANDOM );
3378
3357
if (retval != sizeof (seed )) {
3379
3358
bfdev_log_err ("failed to read seed\n" );
3380
3359
goto error ;
You can’t perform that action at this time.
0 commit comments