mirror of
https://github.com/google/nsjail.git
synced 2026-08-30 18:41:30 -07:00
use TEMP_FAILURE_RETRY with some restartable funcs
This commit is contained in:
@@ -289,7 +289,7 @@ static void LogHandler(
|
||||
bool parseFile(nsjconf_t* nsjconf, const char* file) {
|
||||
LOG_D("Parsing configuration from '%s'", file);
|
||||
|
||||
int fd = open(file, O_RDONLY | O_CLOEXEC);
|
||||
int fd = TEMP_FAILURE_RETRY(open(file, O_RDONLY | O_CLOEXEC));
|
||||
if (fd == -1) {
|
||||
PLOG_W("Couldn't open config file '%s'", file);
|
||||
return false;
|
||||
|
||||
5
util.cc
5
util.cc
@@ -64,8 +64,7 @@ ssize_t readFromFd(int fd, void* buf, size_t len) {
|
||||
}
|
||||
|
||||
ssize_t readFromFile(const char* fname, void* buf, size_t len) {
|
||||
int fd;
|
||||
TEMP_FAILURE_RETRY(fd = open(fname, O_RDONLY | O_CLOEXEC));
|
||||
int fd = TEMP_FAILURE_RETRY(open(fname, O_RDONLY | O_CLOEXEC));
|
||||
if (fd == -1) {
|
||||
LOG_E("open('%s', O_RDONLY|O_CLOEXEC)", fname);
|
||||
return -1;
|
||||
@@ -216,7 +215,7 @@ static void rndInitThread(void) {
|
||||
return;
|
||||
}
|
||||
#endif /* defined(__NR_getrandom) */
|
||||
int fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
|
||||
int fd = TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY | O_CLOEXEC));
|
||||
if (fd == -1) {
|
||||
PLOG_D(
|
||||
"Couldn't open /dev/urandom for reading. Using gettimeofday "
|
||||
|
||||
Reference in New Issue
Block a user