[Libguestfs] [nbdkit PATCH v2 1/3] server: Add nbdkit_stdio_safe

Richard W.M. Jones rjones at redhat.com
Tue Apr 14 07:47:45 UTC 2020


On Mon, Apr 13, 2020 at 07:28:59PM -0500, Eric Blake wrote:
[...]

This patch is fine and can be pushed if you want, but I've got some
small comments.

> +If C<nbdkit_stdio_safe> returns true, the value of the configuration
> +parameter may be used to trigger reading additional data through stdin
> +(such as a password or inline script).

I wonder if we want to say "returns 1" rather than true, to give
ourselves wiggle room in future in case we suddenly decided that we
needed this to return an error indication?  On the other hand, maybe
errors can never happen in any conceivable situation.

> @@ -455,6 +467,10 @@ nbdkit_read_password (const char *value, char **password)
> 
>      if (nbdkit_parse_int ("password file descriptor", &value[1], &fd) == -1)
>        return -1;
> +    if (!nbdkit_stdio_safe () && fd < STDERR_FILENO) {

I think this could be clearer written the other way around:

    if (fd < STDERR_FILENO && !nbdkit_stdio_safe ()) {

but then thinking about this more, why isn't it this?

    if (fd == STDIN_FILENO && !nbdkit_stdio_safe ()) {

Anyway, these are minor points, ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list