[syslinux] [PATCH 4/4] extlinux: simplification by removing one label

Nicolas Cornu nicolac76 at yahoo.fr
Fri Nov 13 12:19:53 PST 2015


Now that xfs_install_file is simplified by using new helpers, we can
remove use of label/goto for clarity.

Signed-off-by: Nicolas Cornu <nicolac76 at yahoo.fr>
---
 extlinux/main.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/extlinux/main.c b/extlinux/main.c
index 43c1a31..8b97a71 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -735,28 +735,22 @@ static int xfs_install_file(const char *path, int devfd, struct stat *rst)
     dirfd = open(path, O_RDONLY | O_DIRECTORY);
     if (dirfd < 0) {
 	perror(path);
-	goto bail;
+	return 1;
     }
 
-    if (ext_install_ldlinux_sys(devfd, path, rst))
-	goto bail;
+    if (ext_install_ldlinux_sys(devfd, path, rst)) {
+	close(dirfd);
+	return 1;
+    }
 
     close(dirfd);
 
-    dirfd = -1;
-
     if (ext_install_ldlinux_c32(path))
-	goto bail;
+	return 1;
 
     sync();
 
     return 0;
-
-bail:
-    if (dirfd >= 0)
-	close(dirfd);
-
-    return 1;
 }
 
 /*
-- 
2.6.2



More information about the Syslinux mailing list