We document that a plugin callback must return -1 on failure, and all other places in the code treat any other value as success (the ideal plugin returns only 0 or -1, but if some existing plugin returns any other value, changing our reaction now might break binary back-compatibility). However, we missed a case: if plugin_zero() falls back to pwrite, we were treating all negative values as failure, even when -2 returned from directly from pwrite is success.
Fixes: 19184d3eb6356ae3b14da0fbaa9c9bdc7743a448 Signed-off-by: Eric Blake <ebl...@redhat.com> --- src/plugins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins.c b/src/plugins.c index dba3e24..699e9c5 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -491,7 +491,7 @@ plugin_zero (struct backend *b, struct connection *conn, while (count) { result = p->plugin.pwrite (connection_get_handle (conn, 0), buf, limit, offset); - if (result < 0) + if (result == -1) break; count -= limit; if (count < limit) -- 2.14.3 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs