[Libguestfs] [nbdkit PATCH 1/2] perl: Fix previous patches

Eric Blake eblake at redhat.com
Tue Jan 31 21:00:34 UTC 2017


Avoid calling nbdkit_set_error with a possibly stale value from
a previous API call; and fix inadvertent hard TABs and malformed
POD text.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 docs/nbdkit-plugin.pod | 2 +-
 plugins/perl/perl.c    | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod
index 4b3a492..3611244 100644
--- a/docs/nbdkit-plugin.pod
+++ b/docs/nbdkit-plugin.pod
@@ -483,7 +483,7 @@ bytes of zeroes at C<offset> in the backing store.  If C<may_trim> is
 non-zero, the operation can punch a hole instead of writing actual
 zero bytes, but only if subsequent reads from the hole read as zeroes.
 If this callback is omitted, or if it fails with C<EOPNOTSUPP>
-(whether by C<nbdkit_set_error or C<errno>), then C<.pwrite> will be
+(whether by C<nbdkit_set_error> or C<errno>), then C<.pwrite> will be
 used instead.

 The callback must write the whole C<count> bytes if it can.  The NBD
diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c
index 52694d9..317a775 100644
--- a/plugins/perl/perl.c
+++ b/plugins/perl/perl.c
@@ -147,9 +147,10 @@ XS(set_error)
 {
   dXSARGS;
   /* Is it worth adding error checking for bad arguments? */
-  if (items >= 1)
+  if (items >= 1) {
     last_error = SvIV (ST (0));
-  nbdkit_set_error (last_error);
+    nbdkit_set_error (last_error);
+  }
   XSRETURN_EMPTY;
 }

@@ -539,8 +540,8 @@ perl_zero (void *handle, uint32_t count, uint64_t offset, int may_trim)

     if (last_error == EOPNOTSUPP) {
       /* When user requests this particular error, we want to
-	 gracefully fall back, and to accomodate both a normal return
-	 and an exception. */
+         gracefully fall back, and to accomodate both a normal return
+         and an exception. */
       nbdkit_debug ("zero requested falling back to pwrite");
       return -1;
     }
-- 
2.9.3




More information about the Libguestfs mailing list