[Libguestfs] [PATCH 2/2] Add .errno_is_preserved to a few plugins.

Richard W.M. Jones rjones at redhat.com
Mon Feb 6 14:57:37 UTC 2017


---
 plugins/example2/example2.c   | 4 ++++
 plugins/example3/example3.c   | 4 ++++
 plugins/file/file.c           | 1 +
 plugins/streaming/streaming.c | 1 +
 4 files changed, 10 insertions(+)

diff --git a/plugins/example2/example2.c b/plugins/example2/example2.c
index a9a0e37..0fd0421 100644
--- a/plugins/example2/example2.c
+++ b/plugins/example2/example2.c
@@ -193,6 +193,10 @@ static struct nbdkit_plugin plugin = {
   .close             = example2_close,
   .get_size          = example2_get_size,
   .pread             = example2_pread,
+  /* In this plugin, errno is preserved properly along error return
+   * paths from failed system calls.
+   */
+  .errno_is_preserved = 1,
 };
 
 NBDKIT_REGISTER_PLUGIN(plugin)
diff --git a/plugins/example3/example3.c b/plugins/example3/example3.c
index 0c215ab..8ac39ae 100644
--- a/plugins/example3/example3.c
+++ b/plugins/example3/example3.c
@@ -214,6 +214,10 @@ static struct nbdkit_plugin plugin = {
   .pread             = example3_pread,
   .pwrite            = example3_pwrite,
   .flush             = example3_flush,
+  /* In this plugin, errno is preserved properly along error return
+   * paths from failed system calls.
+   */
+  .errno_is_preserved = 1,
 };
 
 NBDKIT_REGISTER_PLUGIN(plugin)
diff --git a/plugins/file/file.c b/plugins/file/file.c
index 655fba7..bfa20fb 100644
--- a/plugins/file/file.c
+++ b/plugins/file/file.c
@@ -336,6 +336,7 @@ static struct nbdkit_plugin plugin = {
   .pwrite            = file_pwrite,
   .zero              = file_zero,
   .flush             = file_flush,
+  .errno_is_preserved = 1,
 };
 
 NBDKIT_REGISTER_PLUGIN(plugin)
diff --git a/plugins/streaming/streaming.c b/plugins/streaming/streaming.c
index fb2d3ae..c2deeb6 100644
--- a/plugins/streaming/streaming.c
+++ b/plugins/streaming/streaming.c
@@ -256,6 +256,7 @@ static struct nbdkit_plugin plugin = {
   .get_size          = streaming_get_size,
   .pwrite            = streaming_pwrite,
   .pread             = streaming_pread,
+  .errno_is_preserved = 1,
 };
 
 NBDKIT_REGISTER_PLUGIN(plugin)
-- 
2.10.2




More information about the Libguestfs mailing list