[Libguestfs] [PATCH libnbd 4/4] copy: file-ops.c: Rename clean up label

Nir Soffer nirsof at gmail.com
Mon Mar 1 16:57:46 UTC 2021


Using error: label for code used in normal flow is confusing. This kind
of style was the reason to the famous "goto fail" Apple bug. Lets call
it "out" to make the intent of the code more clear.

Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
 copy/file-ops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/copy/file-ops.c b/copy/file-ops.c
index c6fad06..7c42c7c 100644
--- a/copy/file-ops.c
+++ b/copy/file-ops.c
@@ -109,12 +109,12 @@ page_cache_map (struct rw_file *rwf)
   const size_t veclen = ROUND_UP (rwf->rw.size, page_size) / page_size;
 
   if (byte_vector_reserve (&rwf->cached_pages, veclen) == -1)
-    goto err;
+    goto out;
   if (mincore (ptr, rwf->rw.size, rwf->cached_pages.ptr) == -1)
-    goto err;
+    goto out;
 
   rwf->cached_pages.size = veclen;
- err:
+ out:
   munmap (ptr, rwf->rw.size);
 }
 
-- 
2.26.2




More information about the Libguestfs mailing list