use TEMP_FAILURE_RETRY with some restartable funcs

This commit is contained in:
Robert Swiecki
2019-04-17 23:10:18 +02:00
parent c861be28a9
commit 83a28cd0d3
2 changed files with 3 additions and 4 deletions

View File

@@ -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;

View File

@@ -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 "