From 61082f1afc86ae8c333b36f99c5c09e46333c0a5 Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Thu, 13 Aug 2020 08:03:24 +0900 Subject: [PATCH] Use g_file_test instead of fopen Change-Id: I18e9f8fdd7c267fdc5fcb2e436ab5d37c9851feb Signed-off-by: Minje Ahn --- src/scanner-v2/media-scanner-scan-v2.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/scanner-v2/media-scanner-scan-v2.c b/src/scanner-v2/media-scanner-scan-v2.c index 472b8aa..3fcb3b9 100644 --- a/src/scanner-v2/media-scanner-scan-v2.c +++ b/src/scanner-v2/media-scanner-scan-v2.c @@ -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) -- 2.7.4