diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-11-09 17:06:53 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2015-11-16 14:23:45 +0100 |
commit | f3fbb9a39860a6131a408d07238f5c245fac20a2 (patch) | |
tree | 13d73b6516a6f35ddb6c495e20009e731326b978 | |
parent | 1b9876f761305e499efc3bc6a4dc7d199831cdf8 (diff) | |
download | btrfs-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.c | 3 |
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; |