From e0d617c5adad9f3e76154277fe95aea67f079e53 Mon Sep 17 00:00:00 2001 From: "chen89.chen" Date: Fri, 8 Dec 2017 14:15:05 +0800 Subject: [PATCH] fix block issue of media-scanner when power off Change-Id: I8f0a1fe18effe49cc9ff60e7097ef2f69424992a --- src/scanner-v2/media-scanner-extract-v2.c | 2 +- src/server/media-server-socket.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scanner-v2/media-scanner-extract-v2.c b/src/scanner-v2/media-scanner-extract-v2.c index 1099277..7fe05d6 100755 --- a/src/scanner-v2/media-scanner-extract-v2.c +++ b/src/scanner-v2/media-scanner-extract-v2.c @@ -263,6 +263,7 @@ gboolean msc_folder_extract_thread(void *data) ret = __msc_folder_bulk_extract(handle, extract_data->storage_id, storage_type, update_path, scan_type, end_flag, extract_data->pid, uid, &io_err_count, end_flag); NEXT: + g_directory_extract_processing = false; if (power_off2) { MS_DBG_ERR("power off"); goto _POWEROFF; @@ -284,7 +285,6 @@ NEXT: MS_SAFE_FREE(extract_data); MS_SAFE_FREE(storage_id); - g_directory_extract_processing = false; msc_del_cur_extract_item(); msc_del_cancel_extract_item(); if (msc_get_disc_dir_scan_status()) { diff --git a/src/server/media-server-socket.c b/src/server/media-server-socket.c index ba0e851..0a667d7 100755 --- a/src/server/media-server-socket.c +++ b/src/server/media-server-socket.c @@ -385,7 +385,7 @@ static int __ms_send_request(ms_comm_msg_s *send_msg) int fd = -1; int err = -1; - fd = open(MS_SCANNER_FIFO_PATH_REQ, O_WRONLY); + fd = open(MS_SCANNER_FIFO_PATH_REQ, O_WRONLY|O_NONBLOCK); if (fd < 0) { MS_DBG_STRERROR("fifo open failed"); return MS_MEDIA_ERR_FILE_OPEN_FAIL; -- 2.7.4