Replace thread safe api for checking mount path.
authorHokwon Song <hokwon.song@samsung.com>
Fri, 6 Sep 2013 07:16:09 +0000 (16:16 +0900)
committerHokwon Song <hokwon.song@samsung.com>
Fri, 6 Sep 2013 07:16:09 +0000 (16:16 +0900)
Change-Id: I3d8283c40f5696f2ac1c0972eac3fef1a2622819
Signed-off-by: Hokwon Song <hokwon.song@samsung.com>
src/system-server/runtime/FSys_RuntimeInfo.cpp

index e8b3904..1cb685d 100644 (file)
@@ -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;