Use g_file_test instead of fopen 09/240909/1
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 12 Aug 2020 23:03:24 +0000 (08:03 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 12 Aug 2020 23:03:24 +0000 (08:03 +0900)
Change-Id: I18e9f8fdd7c267fdc5fcb2e436ab5d37c9851feb
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/scanner-v2/media-scanner-scan-v2.c

index 472b8aa..3fcb3b9 100644 (file)
@@ -1025,20 +1025,18 @@ _POWEROFF:
 
 static void __msc_check_pvr_svc(void)
 {
-       if (ms_is_support_pvr()) {
-               MS_DBG_ERR("Waiting PVR service");
-               while (!_msc_is_power_off()) {
-                       FILE* file = fopen("/run/pvr_ready", "rb");
-
-                       if (file != NULL) {
-                               fclose(file);
-                               MS_DBG_WARN("PVR service is ready");
-                               break;
-                       } else {
-                               sleep(1);
-                       }
-               }
+       if (!ms_is_support_pvr())
+               return;
+
+       MS_DBG_ERR("Waiting PVR service");
+       while (!_msc_is_power_off()) {
+               if (g_file_test("/run/pvr_ready", G_FILE_TEST_EXISTS))
+                       break;
+
+               sleep(1);
        }
+
+       MS_DBG_WARN("PVR service is ready");
 }
 
 gpointer msc_storage_scan_thread(gpointer data)