switch to new util file functions

Replace all fopen(), rename(), and unlink() calls with the new util
functions.
This commit is contained in:
Miroslav Lichvar
2019-10-22 18:06:25 +02:00
parent 7dfd4ae556
commit e18903a6b5
10 changed files with 49 additions and 149 deletions

4
util.c
View File

@@ -1263,9 +1263,7 @@ UTI_GetRandomBytesUrandom(void *buf, unsigned int len)
static FILE *f = NULL;
if (!f)
f = fopen(DEV_URANDOM, "r");
if (!f)
LOG_FATAL("Can't open %s : %s", DEV_URANDOM, strerror(errno));
f = UTI_OpenFile(NULL, DEV_URANDOM, NULL, 'R', 0);
if (fread(buf, 1, len, f) != len)
LOG_FATAL("Can't read from %s", DEV_URANDOM);
}