[PATCH v2 12/16] libusbg: Allow to store error information in usbg_state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If error occurred during parsing user should have
an opportunity to get details about place and type
of error.

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
 src/usbg.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/usbg.c b/src/usbg.c
index 3e4725d..3527c1b 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -51,6 +51,7 @@ struct usbg_state
 	char *path;
 
 	TAILQ_HEAD(ghead, usbg_gadget) gadgets;
+	config_t *last_failed_import;
 };
 
 struct usbg_gadget
@@ -599,6 +600,11 @@ static void usbg_free_state(usbg_state *s)
 		usbg_free_gadget(g);
 	}
 
+	if (s->last_failed_import) {
+		config_destroy(s->last_failed_import);
+		free(s->last_failed_import);
+	}
+
 	free(s->path);
 	free(s);
 }
@@ -1255,6 +1261,7 @@ static int usbg_init_state(char *path, usbg_state *s)
 
 	/* State takes the ownership of path and should free it */
 	s->path = path;
+	s->last_failed_import = NULL;
 	TAILQ_INIT(&s->gadgets);
 
 	ret = usbg_parse_gadgets(path, s);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux