list_move(&gc->node, &active_grab_client_list);
gc->btrn = btr_new_node(&(struct btr_node_description)
EMBRACE(.name = name, .parent = parent));
- if (!gc->task.pre_select) {
- gc->task.pre_select = gc_pre_select;
- gc->task.post_select = gc_post_select;
- snprintf(gc->task.status, sizeof(gc->task.status) - 1, "%s", name);
- gc->task.status[sizeof(gc->task.status) - 1] = '\0';
- register_task(&gc->task);
- }
+ gc->task.pre_select = gc_pre_select;
+ gc->task.post_select = gc_post_select;
+ snprintf(gc->task.status, sizeof(gc->task.status) - 1, "%s", name);
+ gc->task.status[sizeof(gc->task.status) - 1] = '\0';
+ gc->task.error = 0;
+ register_task(&gc->task);
}
/**
struct grab_client *gc, *tmp;
list_for_each_entry_safe(gc, tmp, &inactive_grab_client_list, node) {
- if (gc->task.error < 0) {
+ if (gc->fd < 0) {
list_del(&gc->node);
free(gc);
continue;
* post_select().
*/
close(gc->fd);
+ gc->fd = -1;
free(gc->parent);
free(gc->name);
return 1;
}
- gc_activate(gc);
return 0;
}
btr_consume(btrn, ret);
return;
err:
- t->error = gc_close(gc, ret)? ret : 0;
+ gc_close(gc, ret);
+ t->error = ret;
}
static int gc_check_args(int argc, char **argv, struct grab_client *gc)