periodic.timer_fd's value is 0 on inititlize-failed case,
if no value-checking before read(), the code will run as
read(STDIN).

This patch fixed above case.

Signed-off-by: Zhao Lei <zhao...@cn.fujitsu.com>
---
 task-utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/task-utils.c b/task-utils.c
index a4017ff..12b0002 100644
--- a/task-utils.c
+++ b/task-utils.c
@@ -119,6 +119,9 @@ void task_period_wait(struct task_info *info)
        if (!info)
                return;
 
+       if (info->periodic.timer_fd == 0)
+               return;
+
        ret = read(info->periodic.timer_fd, &missed, sizeof (missed));
        if (ret == -1)
                return;
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to