From 0cba3ec8319a3887b2b63132918422a8068210ce Mon Sep 17 00:00:00 2001 From: Hokwon Song Date: Fri, 6 Sep 2013 16:16:09 +0900 Subject: [PATCH] Replace thread safe api for checking mount path. Change-Id: I3d8283c40f5696f2ac1c0972eac3fef1a2622819 Signed-off-by: Hokwon Song --- src/system-server/runtime/FSys_RuntimeInfo.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/system-server/runtime/FSys_RuntimeInfo.cpp b/src/system-server/runtime/FSys_RuntimeInfo.cpp index e8b3904..1cb685d 100644 --- a/src/system-server/runtime/FSys_RuntimeInfo.cpp +++ b/src/system-server/runtime/FSys_RuntimeInfo.cpp @@ -77,16 +77,17 @@ _RuntimeInfo::IsMounted(const char* path) result r = E_SUCCESS; bool mounted = false; const char* table = "/etc/mtab"; - struct mntent* mnt = null; + struct mntent mnt; + char buf[256]; fp = setmntent(table, "r"); SysTryCatch(NID_SYS, fp != null, r = E_SYSTEM, r, "It is failed to open mount table."); SysLog(NID_SYS, "path: %s", path); - while(mnt=getmntent(fp)) + while(getmntent_r(fp, &mnt, buf, sizeof(buf))) { - SysLog(NID_SYS, "mnt_dir: %s", mnt->mnt_dir); - if(strcmp(mnt->mnt_dir, path) == 0) + SysLog(NID_SYS, "mnt_dir: %s", mnt.mnt_dir); + if(strcmp(mnt.mnt_dir, path) == 0) { mounted = true; break; -- 2.7.4