aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-11-09 17:06:53 +0800
committerDavid Sterba <dsterba@suse.com>2015-11-16 14:23:45 +0100
commitf3fbb9a39860a6131a408d07238f5c245fac20a2 (patch)
tree13d73b6516a6f35ddb6c495e20009e731326b978
parent1b9876f761305e499efc3bc6a4dc7d199831cdf8 (diff)
downloadbtrfs-progs-f3fbb9a39860a6131a408d07238f5c245fac20a2.tar.gz
btrfs-progs: Check periodic.timer_fd's value before use
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 <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--task-utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/task-utils.c b/task-utils.c
index a4017ff2..12b00027 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;