Skip to contentSkip to conversation

gfs2_jadd: Fix error handlers

PATCH New Carlos Maiolino 2 participants 2 messages Oct 4, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2_jadd: Fix error handlers

This patch fixes some error handlers, taking
advantage of glic on most places where an error
check is needed.
Also, it adds some exit() calls missing in mkfs
and gfs2_grow

---
 gfs2/mkfs/main_grow.c |    8 ++-
 gfs2/mkfs/main_jadd.c |  149 ++++++++++++++++++++++--------------------------
 gfs2/mkfs/main_mkfs.c |    8 ++-
 3 files changed, 80 insertions(+), 85 deletions(-)
gfs2/mkfs/main_grow.c +6 -2
index c48497f..f6d7bf0 100644
@@ -310,8 +310,10 @@ main_grow(int argc, char *argv[])
 
 		sdp->path_name = argv[optind++];
 		sdp->path_fd = open(sdp->path_name, O_RDONLY | O_CLOEXEC);
-		if (sdp->path_fd < 0)
+		if (sdp->path_fd < 0){
 			perror(sdp->path_name);
+			exit(EXIT_FAILURE);
+		}
 
 		if (check_for_gfs2(sdp)) {
 			perror(sdp->path_name);
@@ -319,8 +321,10 @@ main_grow(int argc, char *argv[])
 		}
 		sdp->device_fd = open(sdp->device_name,
 				      (test ? O_RDONLY : O_RDWR) | O_CLOEXEC);
-		if (sdp->device_fd < 0)
+		if (sdp->device_fd < 0){
 			perror(sdp->device_name);
+			exit(EXIT_FAILURE);
+		}
 
 		if (device_geometry(sdp)) {
 			perror(_("Device geometry error"));
gfs2/mkfs/main_jadd.c +68 -81

264 lines not on this page · raw message

gfs2/mkfs/main_mkfs.c +6 -2
index 771feba..6de1d12 100644
@@ -683,13 +683,17 @@ void main_mkfs(int argc, char *argv[])
 	gfs2_rgrp_free(&sdp->rgtree);
 	error = fsync(sdp->device_fd);
 
-	if (error)
+	if (error){
 		perror(sdp->device_name);
+		exit(EXIT_FAILURE);
+	}
 
 	error = close(sdp->device_fd);
 
-	if (error)
+	if (error){
 		perror(sdp->device_name);
+		exit(EXIT_FAILURE);
+	}
 
 	print_results(sdp, real_device_size, uuid);
 }
Signature · 1 line
1.7.6.2
#1 lore raw

PATCH 1/1 gfs2_jadd: Fix error handlers

----- Original Message -----

| This patch fixes some error handlers, taking
| advantage of glic on most places where an error
| check is needed.
| Also, it adds some exit() calls missing in mkfs
| and gfs2_grow
| 
| Signed-off-by: Carlos Maiolino <[email protected]>
| ---

Hi,

ACK. Looks good. Go ahead and push it.

Regards,

Bob Peterson
Red Hat File Systems