git » libfiu » commit b1d1050

Make fiu_disable() cope with empty enabled_fails

author Alberto Bertogli
2009-06-13 03:53:40 UTC
committer Alberto Bertogli
2009-06-13 03:54:42 UTC
parent 090eb55b013888f4190966003635ab0e6c0da135

Make fiu_disable() cope with empty enabled_fails

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

libfiu/fiu.c +6 -0

diff --git a/libfiu/fiu.c b/libfiu/fiu.c
index cb1d8de..dad5803 100644
--- a/libfiu/fiu.c
+++ b/libfiu/fiu.c
@@ -421,6 +421,12 @@ int fiu_disable(const char *name)
 	/* just find the point of failure and mark it as free by setting its
 	 * name to NULL */
 	ef_wlock();
+
+	if (enabled_fails == NULL) {
+		ef_wunlock();
+		return -1;
+	}
+
 	for (pf = enabled_fails; pf <= enabled_fails_last; pf++) {
 		if (name_matches(pf, name, 1)) {
 			disable_pf(pf);