[Storage] Use getmntent_r() for thread-safe (#3284)

This commit is contained in:
HuangWei
2020-04-09 14:19:09 +08:00
committed by GitHub
parent 614a76beea
commit e32ed28bf4

View File

@ -225,7 +225,9 @@ Status DataDir::_init_file_system() {
bool is_find = false;
struct mntent* mount_entry = NULL;
while ((mount_entry = getmntent(mount_tablet)) != NULL) {
struct mntent ent;
char buf[1024];
while ((mount_entry = getmntent_r(mount_tablet, &ent, buf, sizeof(buf))) != NULL) {
if (strcmp(_path.c_str(), mount_entry->mnt_dir) == 0 ||
strcmp(_path.c_str(), mount_entry->mnt_fsname) == 0) {
is_find = true;