snmp_compile_lib.erl patch

Luke Gorrie luke@REDACTED
Tue Jan 13 14:39:43 CET 2004


Ahoy,

This patch lets the SNMP compiler handle MIBs with no object
definitions. I had to process a MIB with only textual conventions.

Index: snmp_compile_lib.erl
===================================================================
RCS file: /home/share/erlang/cvsroot/otp/lib/snmp/src/snmp_compile_lib.erl,v
retrieving revision 1.5
diff -u -u -r1.5 snmp_compile_lib.erl
--- snmp_compile_lib.erl	3 Sep 2003 13:54:14 -0000	1.5
+++ snmp_compile_lib.erl	7 Jan 2004 15:04:39 -0000
@@ -1475,8 +1475,13 @@
 
 
 resolve_oids(OidEts) ->
-    [{_, _, _, _, RootChildren}] = ets:lookup(OidEts, root),
-    resolve_oids(RootChildren, [], OidEts).
+    case ets:lookup(OidEts, root) of
+	[{_, _, _, _, RootChildren}] ->
+	    resolve_oids(RootChildren, [], OidEts);
+	[] ->
+	    %% No OIDs registered
+	    ok
+    end.
 
 resolve_oids([Name | T], FatherOid, OidEts) ->
     {MyOid, MyChildren, MyLine} =




More information about the erlang-patches mailing list