Add missing O_RDONLY here and there

This commit is contained in:
Robert Swiecki 2018-02-08 15:23:15 +01:00
parent 19ea0703f2
commit d7cb58e280
2 changed files with 2 additions and 2 deletions

View File

@ -309,7 +309,7 @@ static void LogHandler(
extern "C" bool configParse(struct nsjconf_t* nsjconf, const char* file) { extern "C" bool configParse(struct nsjconf_t* nsjconf, const char* file) {
LOG_I("Parsing configuration from '%s'", file); LOG_I("Parsing configuration from '%s'", file);
int fd = open(file, O_RDONLY); int fd = open(file, O_RDONLY | O_CLOEXEC);
if (fd == -1) { if (fd == -1) {
PLOG_W("Couldn't open config file '%s'", file); PLOG_W("Couldn't open config file '%s'", file);
return false; return false;

View File

@ -178,7 +178,7 @@ static bool containMakeFdsCOENaive(struct nsjconf_t* nsjconf) {
static bool containMakeFdsCOEProc(struct nsjconf_t* nsjconf) { static bool containMakeFdsCOEProc(struct nsjconf_t* nsjconf) {
int dirfd = open("/proc/self/fd", O_DIRECTORY | O_RDONLY | O_CLOEXEC); int dirfd = open("/proc/self/fd", O_DIRECTORY | O_RDONLY | O_CLOEXEC);
if (dirfd == -1) { if (dirfd == -1) {
PLOG_D("open('/proc/self/fd', O_DIRECTORY|O_RDONLY)"); PLOG_D("open('/proc/self/fd', O_DIRECTORY|O_RDONLY|O_CLOEXEC)");
return false; return false;
} }
DIR* dir = fdopendir(dirfd); DIR* dir = fdopendir(dirfd);