From 4f046068117ee17f6e0e25cef785f00db2e856f8 Mon Sep 17 00:00:00 2001 From: "LongPing.WEI" Date: Fri, 23 Nov 2018 19:27:35 +0800 Subject: [PATCH] Use setmntent with "e" option Otherwise it will cause selinux warning in children processes sometimes Change-Id: I41239c3f9779140622076c644a5f63051d00eaa8 --- Utils.cpp | 2 +- VolumeManager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Utils.cpp b/Utils.cpp index 04c3956..ce1f777 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -766,7 +766,7 @@ bool IsRunningInEmulator() { } status_t UnmountTree(const std::string& prefix) { - FILE* fp = setmntent("/proc/mounts", "r"); + FILE* fp = setmntent("/proc/mounts", "re"); if (fp == NULL) { PLOG(ERROR) << "Failed to open /proc/mounts"; return -errno; diff --git a/VolumeManager.cpp b/VolumeManager.cpp index 21136cf..59a3d1b 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -589,7 +589,7 @@ int VolumeManager::unmountAll() { // Worst case we might have some stale mounts lurking around, so // force unmount those just to be safe. - FILE* fp = setmntent("/proc/mounts", "r"); + FILE* fp = setmntent("/proc/mounts", "re"); if (fp == NULL) { PLOG(ERROR) << "Failed to open /proc/mounts"; return -errno;