From 13a5f5737be178996c57c0b9870dccf2849ea130 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 13 Oct 2020 19:14:51 -0700 Subject: [PATCH] fix params permissions after refactor old-commit-hash: 6f307ea4c560070f1eb7e02218f9de17adc3ab86 --- selfdrive/common/params.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/selfdrive/common/params.cc b/selfdrive/common/params.cc index 28129daf2..73839a638 100644 --- a/selfdrive/common/params.cc +++ b/selfdrive/common/params.cc @@ -75,18 +75,20 @@ static int fsync_dir(const char* path){ static int mkdir_p(std::string path) { char * _path = (char *)path.c_str(); + mode_t prev_mask = umask(0); for (char *p = _path + 1; *p; p++) { if (*p == '/') { *p = '\0'; // Temporarily truncate - if (mkdir(_path, 0775) != 0) { + if (mkdir(_path, 0777) != 0) { if (errno != EEXIST) return -1; } *p = '/'; } } - if (mkdir(_path, 0775) != 0) { + if (mkdir(_path, 0777) != 0) { if (errno != EEXIST) return -1; } + umask(prev_mask); return 0; }