Skip to contentSkip to conversation

master - style: Standardise some error paths.

PATCH Alasdair Kergon 1 participant 1 message Sep 5, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fb123084166634e8f3b8550520391df369e9db70
Commit:        fb123084166634e8f3b8550520391df369e9db70
Parent:        f5a3b05c7ac8474cd323558399d2886f8edb5731
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Sat Sep 5 23:56:30 2015 +0100
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Sat Sep 5 23:56:30 2015 +0100

style: Standardise some error paths.

---
 daemons/cmirrord/functions.c   |    4 +-
 daemons/lvmetad/lvmetad-core.c |    2 +-
 lib/metadata/metadata.c        |    3 +-
 libdm/libdm-file.c             |    4 +-
 libdm/libdm-report.c           |    2 +-
 libdm/libdm-stats.c            |  197 +++++++++--------
 liblvm/lvm_pv.c                |    5 +-
 tools/dmsetup.c                |  475 ++++++++++++++++++++--------------------
 8 files changed, 355 insertions(+), 337 deletions(-)
daemons/cmirrord/functions.c +2 -2
index 61b3e11..4f36cc6 100644
@@ -1445,7 +1445,7 @@ static int disk_status_info(struct log_c *lc, struct dm_ulog_request *rq)
 	char *data = (char *)rq->data;
 	struct stat statbuf;
 
-	if(fstat(lc->disk_fd, &statbuf)) {
+	if (fstat(lc->disk_fd, &statbuf)) {
 		rq->error = -errno;
 		return -errno;
 	}
@@ -1508,7 +1508,7 @@ static int disk_status_table(struct log_c *lc, struct dm_ulog_request *rq)
 	char *data = (char *)rq->data;
 	struct stat statbuf;
 
-	if(fstat(lc->disk_fd, &statbuf)) {
+	if (fstat(lc->disk_fd, &statbuf)) {
 		rq->error = -errno;
 		return -errno;
 	}
daemons/lvmetad/lvmetad-core.c +1 -1
index 19e8723..89aaaf8 100644
@@ -578,7 +578,7 @@ static void mark_outdated_pv(lvmetad_state *s, const char *vgid, const char *pvi
 		    !(cft_vgid = make_text_node(outdated_pvs, "vgid", dm_pool_strdup(outdated_pvs->mem, vgid),
 						outdated_pvs->root, NULL)))
 			abort();
-		if(!dm_hash_insert(s->vgid_to_outdated_pvs, cft_vgid->v->v.str, outdated_pvs))
+		if (!dm_hash_insert(s->vgid_to_outdated_pvs, cft_vgid->v->v.str, outdated_pvs))
 			abort();
 		DEBUGLOG(s, "created outdated_pvs list for VG %s", vgid);
 	}
lib/metadata/metadata.c +2 -1
index 8757331..b45f850 100644
@@ -319,10 +319,11 @@ static struct pv_list *_copy_pvl(struct dm_pool *pvmem, struct pv_list *pvl_from
 	if (!(pvl_to->pv = dm_pool_alloc(pvmem, sizeof(*pvl_to->pv))))
 		goto_bad;
 
-	if(!_copy_pv(pvmem, pvl_to->pv, pvl_from->pv))
+	if (!_copy_pv(pvmem, pvl_to->pv, pvl_from->pv))
 		goto_bad;
 
 	return pvl_to;
+
 bad:
 	dm_pool_free(pvmem, pvl_to);
 	return NULL;
libdm/libdm-file.c +2 -2
index 52f9d45..e4beddd 100644
@@ -119,8 +119,8 @@ int dm_create_lockfile(const char *lockfile)
 	char buffer[50];
 	int retries = 0;
 
-	if((fd = open(lockfile, O_CREAT | O_WRONLY,
-		      (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) {
+	if ((fd = open(lockfile, O_CREAT | O_WRONLY,
+		       (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) {
 		log_error("Cannot open lockfile [%s], error was [%s]",
 			  lockfile, strerror(errno));
 		return 0;
libdm/libdm-report.c +1 -1
index 6416f18..10ab7df 100644
@@ -4195,7 +4195,7 @@ static void _destroy_rows(struct dm_report *rh)
 	 * pool allocation this will also free all subsequently allocated
 	 * rows from the report and any associated string data.
 	 */
-	if(rh->first_row)
+	if (rh->first_row)
 		dm_pool_free(rh->mem, rh->first_row);
 	rh->first_row = NULL;
 	dm_list_init(&rh->rows);
libdm/libdm-stats.c +107 -90

602 lines not on this page · raw message

liblvm/lvm_pv.c +2 -3
index 24b2732..5933e0a 100644
@@ -155,9 +155,8 @@ static struct dm_list *_lvm_list_pvs(lvm_t libh)
 	} else {
 		dm_list_init(&rc->pvslist);
 		dm_list_init(&rc->vgslist);
-		if( !get_pvs_perserve_vg(cmd, &rc->pvslist, &rc->vgslist) ) {
-			return NULL;
-		}
+		if (!get_pvs_perserve_vg(cmd, &rc->pvslist, &rc->vgslist))
+			return_NULL;
 
 		/*
 		 * If we have no PVs we still need to have access to cmd
tools/dmsetup.c +238 -237

1,321 lines not on this page · raw message