Hi, Miro Palmu wrote: > In lib/pipe-filter.h above pipe_filter_gi_create is says: > > > If the subprocess does not start correctly, > > exit if exit_on_error is true, otherwise return NULL and set errno. > > However looking at the implementation (lib/pipe-filter-gi.c) > of the case that exit_on_error is false, > it seems that what is done and what is documented are not the same. > > In this error handling part it does not set the retunred filter to NULL: > > ''' > struct pipe_filter_gi * > pipe_filter_gi_create(...) { > > ... > > if (filter->child == -1) > { > /* Child process could not be created. > Arrange for filter_retcode (filter) to be the current errno. > */ > filter->writer_errno = errno; > filter->writer_terminated = true; > filter->exited = true; > } > else if (filter_init (filter) < 0) > filter_terminate (filter); > > return filter; > } > '''
Thanks. In the documentation, indeed, "otherwise return NULL and set errno" contradicts "Return the freshly created 'struct pipe_filter_gi'." Fixed like this: 2024-10-26 Bruno Haible <br...@clisp.org> pipe-filter-gi: Correct documentation. Reported by Miro Palmu <em...@miropalmu.cc> in <https://lists.gnu.org/archive/html/bug-gnulib/2024-10/msg00199.html>. * lib/pipe-filter.h (pipe_filter_gi_create): Don't say that this function may return NULL. diff --git a/lib/pipe-filter.h b/lib/pipe-filter.h index 4d116f26ff..1e0ca9b307 100644 --- a/lib/pipe-filter.h +++ b/lib/pipe-filter.h @@ -185,7 +185,7 @@ extern int - If exit_on_error is true, any error will cause the main process to exit with an error status. If the subprocess does not start correctly, exit if exit_on_error is - true, otherwise return NULL and set errno. + true. The caller will write to the subprocess through pipe_filter_gi_write and finally call pipe_filter_gi_close. During such calls, the