With the old code, the command "para_write < /dev/null" would
segfault because the wng_close() is called although the writer
node group was never opened. Fix this bug by introducing a new
field in struct writer_node_group that tracks whether wng_open()
was called.
unsigned int *samplerate;
/** the task associated to this group */
struct task task;
unsigned int *samplerate;
/** the task associated to this group */
struct task task;
+ /** Whether the group is open, i.e. wng_open() was called. */
+ int open;
};
/** loop over each writer node in a writer group */
};
/** loop over each writer node in a writer group */
}
sprintf(g->task.status, "%s", "writer node group");
register_task(&g->task);
}
sprintf(g->task.status, "%s", "writer node group");
register_task(&g->task);
return 1;
err_out:
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
return 1;
err_out:
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
return;
PARA_NOTICE_LOG("closing wng with %d writer(s)\n", g->num_writers);
FOR_EACH_WRITER_NODE(i, g) {
return;
PARA_NOTICE_LOG("closing wng with %d writer(s)\n", g->num_writers);
FOR_EACH_WRITER_NODE(i, g) {