[svn-commits] tzafrir: branch tools/tzafrir/sysfs r8774 - /tools/team/tzafrir/sysfs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 14 18:24:31 CDT 2010


Author: tzafrir
Date: Mon Jun 14 18:24:27 2010
New Revision: 8774

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8774
Log:
dahdi_cfg -- better error handling

* Make sure that link pointing to span contains a valid span number.
* If we run from UDEV (with '-S' option). No need to shout about
  irrelevant spans.

Modified:
    tools/team/tzafrir/sysfs/dahdi_cfg.c

Modified: tools/team/tzafrir/sysfs/dahdi_cfg.c
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/dahdi_cfg.c?view=diff&rev=8774&r1=8773&r2=8774
==============================================================================
--- tools/team/tzafrir/sysfs/dahdi_cfg.c (original)
+++ tools/team/tzafrir/sysfs/dahdi_cfg.c Mon Jun 14 18:24:27 2010
@@ -403,7 +403,15 @@
 			return -1;
 		}
 	}
-	if(span_names[span] == NULL) {
+	if (span < 0 || span >= DAHDI_MAX_SPANS) {
+		if(keep_going) {
+			return 0;
+		} else {
+			error("Span number %d is out of range\n", span);
+			return -1;
+		}
+	}
+	if (span_names[span] == NULL) {
 		span_names[span] = strdup(path);
 		if (debug & DEBUG_PARSER) {
 			printf("%s: %d -> %s\n", __func__, span, span_names[span]);
@@ -556,12 +564,12 @@
 
 		*pname = '\0';
 		in_span = span_string2num(prefix);
+		if(only_span_num && only_span_num != in_span)
+			return 0;
 		if(in_span <= 0) {
 			error("Bad span string '%s'\n", prefix);
 			return -1;
 		}
-		if(only_span_num && only_span_num != in_span)
-			return 0;
 		argstr = pname + 1;
 		str_replace(prefix, '!', '/');
 		pname = prefix;




More information about the svn-commits mailing list