[Libguestfs] [nbdkit PATCH 0/2] stdin/out cleanups

Richard W.M. Jones rjones at redhat.com
Tue Apr 7 07:55:08 UTC 2020


On Sat, Apr 04, 2020 at 05:02:37PM -0500, Eric Blake wrote:
> This is what I've been playing with in response to my earlier question
> about what to do with 'nbdkit -s sh -'
> (https://www.redhat.com/archives/libguestfs/2020-April/msg00032.html)
> 
> I'm still open to ideas on a better name, and/or whether adding
> <stdbool.h> to our public include files is a good idea (if not,
> returning int instead of bool is tolerable).

The answer is: no, we cannot use <stdbool.h>.  This is because we
advertise that we support using the headers in plugins which are pure
C90 code.

We also test this -- see tests/Makefile.am test-ansi-c-plugin.la --
however it may be that the test doesn't work properly if it didn't
fail after your change.

The solution is quite simple - return an int instead.
Cf. nbdkit_parse_bool

Rich.

> Eric Blake (2):
>   server: Add nbdkit_stdio_safe
>   server: Sanitize stdin/out before running plugin code
> 
>  docs/nbdkit-plugin.pod          | 23 +++++++++++++++++++-
>  plugins/sh/nbdkit-sh-plugin.pod |  4 +++-
>  include/nbdkit-common.h         |  2 ++
>  server/internal.h               |  2 ++
>  server/background.c             | 12 ++++-------
>  server/captive.c                | 10 +++++++--
>  server/connections.c            | 12 -----------
>  server/main.c                   | 38 ++++++++++++++++++++++++++++++---
>  server/nbdkit.syms              |  1 +
>  server/public.c                 | 18 +++++++++++++++-
>  server/test-public.c            | 23 ++++++++++++++++++--
>  plugins/sh/sh.c                 |  7 +++++-
>  tests/test-layers-plugin.c      | 12 ++++++++++-
>  tests/test-layers.c             |  4 +++-
>  14 files changed, 135 insertions(+), 33 deletions(-)
> 
> -- 
> 2.26.0.rc2
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list