summaryrefslogtreecommitdiff
path: root/task-utils.c
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-07-27 20:24:30 +0800
committerDavid Sterba <dsterba@suse.com>2015-08-31 19:25:10 +0200
commitcb3424cd23c4c682063d1aa89347fec0736d9c4d (patch)
tree3e1735475c77e51b6fe4b3e729e22c0024152d53 /task-utils.c
parentf156337dc8e5a11b6bd5492e6820ed3c455fc0e5 (diff)
btrfs-progs: Set info->periodic.timer_fd to 0 in init-fail
In current code, (info->periodic.timer_fd == 0) means it is not valid, as: if (info->periodic.timer_fd) { close(info->periodic.timer_fd); ... We need set its value from -1 to 0 in create-fail case, to make code like above works. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'task-utils.c')
-rw-r--r--task-utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/task-utils.c b/task-utils.c
index 768be946..58f51950 100644
--- a/task-utils.c
+++ b/task-utils.c
@@ -94,8 +94,10 @@ int task_period_start(struct task_info *info, unsigned int period_ms)
return -1;
info->periodic.timer_fd = timerfd_create(CLOCK_MONOTONIC, 0);
- if (info->periodic.timer_fd == -1)
+ if (info->periodic.timer_fd == -1) {
+ info->periodic.timer_fd = 0;
return info->periodic.timer_fd;
+ }
info->periodic.wakeups_missed = 0;