Skip to contentSkip to conversation

Pending patches in O.S. Systems' tree

PATCH In review Otavio Salvador 2 participants 11 messages Feb 17, 2012 – Feb 18, 2012

lore
Share & tools
lore
#0 lore raw

cover Pending patches in O.S. Systems' tree

The following changes since commit 83281ff6b918b05f0d12d11a0a031db30f7fb1a5:

xfce4-settings: Update to latest stable version 4.8.3. (2012-02-14 15:15:54 +0100)

are available in the git repository at:
git://github.com/OSSystems/meta-oe master
https://github.com/OSSystems/meta-oe/tree/master

Otavio Salvador (7):
Revert "systemd.bbclass: depends on systemd"
udisks: explicitly depends on systemd
polkit: depends on systemd
net-snmp: sync with 5.7 maintainence branch
net-snmp: use netlink support
net-snmp: move static libs onto ${PN}-staticdev
openbox: add 3.4.11.2

 meta-oe/classes/systemd.bbclass                    |    2 +-
 .../net-snmp/files/libnl-3-support.patch           |   69 +
 .../net-snmp/files/sync-with-5.7-branch.patch      |19998 ++++++++++++++++++++
 meta-oe/recipes-extended/net-snmp/net-snmp.inc     |    9 +-
 .../recipes-extended/net-snmp/net-snmp_5.7.1.bb    |    4 +-
 .../recipes-extended/polkit/polkit_0.104.bbappend  |    3 +
 .../openbox/openbox/fix-decorations.patch          |   73 +
 .../openbox/openbox/fix-dialog-buttons.patch       |   38 +
 .../openbox/openbox/sync-with-3.4-working.patch    | 2739 +++
 .../recipes-graphics/openbox/openbox_3.4.11.2.bb   |   40 +
 meta-oe/recipes-support/udisks/udisks_1.0.4.bb     |    4 +-
 11 files changed, 22970 insertions(+), 9 deletions(-)
 create mode 100644 meta-oe/recipes-extended/net-snmp/files/libnl-3-support.patch
 create mode 100644 meta-oe/recipes-extended/net-snmp/files/sync-with-5.7-branch.patch
 create mode 100644 meta-oe/recipes-extended/polkit/polkit_0.104.bbappend
 create mode 100644 meta-oe/recipes-graphics/openbox/openbox/fix-decorations.patch
 create mode 100644 meta-oe/recipes-graphics/openbox/openbox/fix-dialog-buttons.patch
 create mode 100644 meta-oe/recipes-graphics/openbox/openbox/sync-with-3.4-working.patch
 create mode 100644 meta-oe/recipes-graphics/openbox/openbox_3.4.11.2.bb
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 1/7 Revert "systemd.bbclass: depends on systemd"

This reverts commit c029d4a268de1ac7076fbeb9e337e96fdb1b226d.

---
 meta-oe/classes/systemd.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta-oe/classes/systemd.bbclass +1 -1
index 094a12c..2ca7bfc 100644
@@ -1,4 +1,4 @@
-DEPENDS_append = " systemd systemd-systemctl-native"
+DEPENDS_append = " systemd-systemctl-native"
 
 systemd_postinst() {
 OPTS=""
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 2/7 udisks: explicitly depends on systemd

In reply to Otavio Salvador
---
 meta-oe/recipes-support/udisks/udisks_1.0.4.bb |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
meta-oe/recipes-support/udisks/udisks_1.0.4.bb +2 -2
index 55b115e..9ffaca5 100644
@@ -2,7 +2,7 @@ DESCRIPTION = "A storage daemon that implements well-defined D-Bus interfaces th
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=73d83aebe7e4b62346afde80e0e94273"
 
-DEPENDS = "libatasmart sg3-utils polkit udev dbus-glib glib-2.0"
+DEPENDS = "libatasmart sg3-utils polkit udev dbus-glib glib-2.0 systemd"
 # optional dependencies: device-mapper parted
 
 SRC_URI = "http://hal.freedesktop.org/releases/${BPN}-${PV}.tar.gz;name=${BPN} \
@@ -12,7 +12,7 @@ SRC_URI = "http://hal.freedesktop.org/releases/${BPN}-${PV}.tar.gz;name=${BPN} \
 SRC_URI[udisks.md5sum] = "86c63b2b5484f2060499a052b5b6256b"
 SRC_URI[udisks.sha256sum] = "854b89368733b9c3a577101b761ad5397ae75a05110c8698ac5b29de9a8bf8f5"
 
-PR = "r2"
+PR = "r3"
 
 inherit autotools systemd
 
Signature · 1 line
1.7.2.5
#3 lore raw

PATCH 3/7 polkit: depends on systemd

In reply to Otavio Salvador
---
 .../recipes-extended/polkit/polkit_0.104.bbappend  |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 meta-oe/recipes-extended/polkit/polkit_0.104.bbappend
meta-oe/recipes-extended/polkit/polkit_0.104.bbappend new file +3 -0
new file mode 100644
index 0000000..3c43970
@@ -0,0 +1,3 @@
+DEPENDS += "systemd"
+
+PRINC = "1"
Signature · 1 line
1.7.2.5
#4 lore raw

Re: [PATCH][meta-oe 3/7] polkit: depends on systemd

Quoted 5 lines · Otavio Salvador
---
 .../recipes-extended/polkit/polkit_0.104.bbappend  |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 meta-oe/recipes-extended/polkit/polkit_0.104.bbappend

This looks like that old version I had commented before, please update it.

Cheers,

Quoted 18 lines
meta-oe/recipes-extended/polkit/polkit_0.104.bbappend new file +3 -0
new file mode 100644
index 0000000..3c43970
@@ -0,0 +1,3 @@
+DEPENDS += "systemd"
+
+PRINC = "1"
Signature · 7 lines
1.7.2.5


_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#5 lore raw

Re: [PATCH][meta-oe 3/7] polkit: depends on systemd

Quoted 10 lines · Martin Jansa
Quoted 5 lines · Otavio Salvador
---
 .../recipes-extended/polkit/polkit_0.104.bbappend  |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 meta-oe/recipes-extended/polkit/polkit_0.104.bbappend

This looks like that old version I had commented before, please update it.

Please send me a patch that works for your need since I didn't fully get what you wanted on it; in this case I can merge it on our tree and send an updated patchset.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#6 lore raw

PATCH 1/1 polkit: enable and disable systemd/consolekit support explicitly

* people using sysvinit already have or can set something like task-core-boot.bb does VIRTUAL-RUNTIME_init_manager ?= "sysvinit" to disable systemd explicitly (so it's not picked by shlib when it's available because other packages).
* and for the rest it will disable consolekit and enable systemd explititly

---
 .../recipes-extended/polkit/polkit_0.104.bbappend  |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
 create mode 100644 meta-oe/recipes-extended/polkit/polkit_0.104.bbappend
meta-oe/recipes-extended/polkit/polkit_0.104.bbappend new file +6 -0
new file mode 100644
index 0000000..d649f61
@@ -0,0 +1,6 @@
+PRINC := "${@int(PRINC) + 3}"
+
+PACKAGECONFIG ??= "${@base_contains('VIRTUAL-RUNTIME_init_manager', 'sysvinit', 'consolekit', 'systemd', d)}"
+PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd,systemd"
+# there is no --enable/--disable option for consolekit and it's not picked by shlibs, so add it to RDEPENDS
+PACKAGECONFIG[consolekit] = ",,,consolekit"
Signature · 1 line
1.7.8.4
#7 lore raw

PATCH 4/7 net-snmp: sync with 5.7 maintainence branch

In reply to Otavio Salvador
---
 .../net-snmp/files/sync-with-5.7-branch.patch      |19998 ++++++++++++++++++++
 .../recipes-extended/net-snmp/net-snmp_5.7.1.bb    |    3 +-
 2 files changed, 20000 insertions(+), 1 deletions(-)
 create mode 100644 meta-oe/recipes-extended/net-snmp/files/sync-with-5.7-branch.patch
meta-oe/recipes-extended/net-snmp/files/sync-with-5.7-branch.patch new file +19998 -0
new file mode 100644
index 0000000..442e8d0
@@ -0,0 +1,19998 @@
+Sync with 5.7 branch
+
+This syncs v5.7.1 to 2012-02-08 5.7 GIT branch status
+
+Upstream-Status: Backport
+
+diff --git a/.gitignore b/.gitignore
+index 9d6a15f..9cfb7a3 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -1,9 +1,9 @@
+ *.bak
+ *.bs
+-*.la
+-*.lo
+ *.ft
+ *.ft.1
++*.la
++*.lo
+ *.made
+ *.o
+ *.obj
+@@ -78,7 +78,10 @@ net-snmp-config
+ net-snmp-config-x
+ net-snmp-create-v3-user
+ NEWS.new*
++perl/*.yml
+ perl/*/*.def
++perl/*/*.yml
++perl/*/*/*.yml
+ perl/agent/agent.c
+ perl/agent/default_store/default_store.c
+ perl/agent/default_store/default_store.def
+@@ -96,6 +99,7 @@ perl/TrapReceiver/const-c.inc
+ perl/TrapReceiver/const-xs.inc
+ perl/TrapReceiver/TrapReceiver.c
+ pm_to_blib
++python/build
+ sedscript
+ snmplib/snmpsm_init.h
+ snmplib/snmpsm_shutdown.h
+diff --git a/COPYING b/COPYING
+index afe6e6d..d368331 100644
+--- a/COPYING
++++ b/COPYING
+@@ -135,7 +135,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+ ---- Part 5: Sparta, Inc copyright notice (BSD) -----
+ 
+-Copyright (c) 2003-2011, Sparta, Inc
++Copyright (c) 2003-2012, Sparta, Inc
+ All rights reserved.
+  
+ Redistribution and use in source and binary forms, with or without
+diff --git a/Makefile.in b/Makefile.in
+index f3dd7b7..9664676 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -85,22 +85,23 @@ libtool:	$(LIBTOOL_DEPS)
+ 	$(SHELL) ./config.status --recheck
+ 
+ 
+-snmplib:
++snmplib: @FEATURETARGS@
+ 	@(cd snmplib; $(MAKE) )
+ 
+-agent:
++agent: @FEATURETARGS@
+ 	@(cd snmplib; $(MAKE) )
+ 	@(cd agent; $(MAKE) )
+ 
+-apps:
++apps: @FEATURETARGS@
+ 	@(cd snmplib; $(MAKE) )
++	@(cd agent; $(MAKE) libs)
+ 	@(cd apps; $(MAKE) )
+ 
+-snmpget snmpbulkget snmpwalk snmpbulkwalk snmptranslate snmpstatus snmpdelta snmptable snmptest snmpset snmpusm snmpvacm snmpgetnext encode_keychange snmpdf snmptrap snmptls:
++snmpget snmpbulkget snmpwalk snmpbulkwalk snmptranslate snmpstatus snmpdelta snmptable snmptest snmpset snmpusm snmpvacm snmpgetnext encode_keychange snmpdf snmptrap snmptls: @FEATURETARGS@
+ 	@(cd snmplib; $(MAKE) )
+ 	@(cd apps; $(MAKE) $@ )
+ 
+-snmptrapd:
++agentxtrap snmptrapd: @FEATURETARGS@
+ 	@(cd snmplib; $(MAKE) )
+ 	@(cd agent; $(MAKE) libs)
+ 	@(cd apps; $(MAKE) $@ )
+diff --git a/agent/Makefile.in b/agent/Makefile.in
+index 84a5e4c..59cf4ef 100644
+--- a/agent/Makefile.in
++++ b/agent/Makefile.in
+@@ -114,7 +114,6 @@ USELIBS		= ../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+ AGENTLIB	= libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION)
+ MIBLIB		= libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION)
+ 
+-LOCAL_LIBS	= -L../snmplib/.libs -L../snmplib -L./.libs
+ LAGENTLIBS	= @LAGENTLIBS@
+ LMIBLIBS	= @LMIBLIBS@
+ VAL_LIBS	= @VAL_LIBS@
+@@ -282,34 +281,33 @@ all: agentlib subdirs miblib $(INSTALLBINPROGS) $(INSTALLSBINPROGS)
+ # build stuff targets
+ #
+ getkstat: getkstat.o
+-	$(CC) $(CFLAGS) -o $@ $? $(LOCAL_LIBS) $(LIBS)
++	$(CC) $(CFLAGS) -o $@ $? $(LIBS)
+ 
+ getkstat.o: mibgroup/kernel_sunos5.c
+ 	$(CC) $(CFLAGS) -o $@ -D_GETKSTAT_TEST -DDODEBUG -c $? 
+ 
+ getmibstat: getmibstat.o
+-	$(CC) $(CFLAGS) -o $@ $? $(LOCAL_LIBS) $(LIBS)
++	$(CC) $(CFLAGS) -o $@ $? $(LIBS)
+ 
+ getmibstat.o: mibgroup/kernel_sunos5.c
+ 	$(CC) $(CFLAGS) -o $@ -D_GETMIBSTAT_TEST -DDODEBUG -c $? 
+ 
+-snmpd$(EXEEXT):	${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(MIBLIB) $(LIBTARG) 
+-	$(LINK) $(CFLAGS) -o $@ ${LAGENTOBJS} $(LOCAL_LIBS) ${LDFLAGS} ${OUR_AGENT_LIBS}
+-
++snmpd$(EXEEXT):	${LAGENTOBJS} $(USELIBS) $(AGENTLIB) $(HELPERLIB) $(MIBLIB) $(LIBTARG) 
++	$(LINK) $(CFLAGS) -o $@ ${LAGENTOBJS} ${LDFLAGS} ${OUR_AGENT_LIBS}
+ 
+ libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION):    ${LLIBAGENTOBJS} $(USELIBS)
+ 	$(LIB_LD_CMD) $(AGENTLIB) ${LLIBAGENTOBJS} $(USELIBS) ${LAGENTLIBS} @LD_NO_UNDEFINED@ $(LDFLAGS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) @AGENTLIBS@
+ 	$(RANLIB) $(AGENTLIB)
+ 
+ libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION): ${LMIBOBJS} $(AGENTLIB) $(USELIBS)
+-	$(LIB_LD_CMD) $(MIBLIB) ${LMIBOBJS} $(AGENTLIB) $(USELIBS) @LD_NO_UNDEFINED@ $(LDFLAGS) ${LMIBLIBS} $(LIB_LD_LIBS) @AGENTLIBS@
++	$(LIB_LD_CMD) $(MIBLIB) ${LMIBOBJS} $(AGENTLIB) $(USELIBS) @LD_NO_UNDEFINED@ $(LDFLAGS) ${LMIBLIBS} $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) @AGENTLIBS@
+ 	$(RANLIB) $(MIBLIB)
+ 
+ agentlib: $(AGENTLIB)
+ 
+ miblib: $(MIBLIB)
+ 
+-libs: $(INSTALLLIBS)
++libs: $(AGENTLIB) $(MIBLIB)
+ 
+ embedperlinstall:
+ 	  @$(SHELL) $(srcdir)/../mkinstalldirs $(INSTALL_PREFIX)$(snmplibdir)
+diff --git a/agent/agent_handler.c b/agent/agent_handler.c
+index da64761..59e9613 100644
+--- a/agent/agent_handler.c
++++ b/agent/agent_handler.c
+@@ -774,7 +774,7 @@ netsnmp_handler_registration_free(netsnmp_handler_registration *reginfo)
+ /** Duplicates handler registration object and all subsequent handlers.
+  *  Creates a copy of the handler registration object and all its data.
+  *
+- *  @param handler is the handler registration object to be duplicated
++ *  @param reginfo is the handler registration object to be duplicated
+  *
+  *  @return Returns a pointer to the complete copy,
+  *         or NULL if any problem occured.
+@@ -922,7 +922,8 @@ netsnmp_free_delegated_cache(netsnmp_delegated_cache *dcache)
+  *  Sweeps through given chain of requests and sets 'delegated'
+  *  flag accordingly to the isdelegaded parameter.
+  *
+- *  @param isdelegaded New value of the 'delegated' flag.
++ *  @param requests Request list.
++ *  @param isdelegated New value of the 'delegated' flag.
+  */
+ void
+ netsnmp_handler_mark_requests_as_delegated(netsnmp_request_info *requests,
+diff --git a/agent/agent_read_config.c b/agent/agent_read_config.c
+index 3514f0f..f9ef1af 100644
+--- a/agent/agent_read_config.c
++++ b/agent/agent_read_config.c
+@@ -115,13 +115,10 @@ netsnmp_feature_child_of(snmpd_unregister_config_handler, agent_read_config_all)
+ void
+ snmpd_set_agent_user(const char *token, char *cptr)
+ {
+-#if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H)
+-    struct passwd  *info;
+-#endif
+-
+     if (cptr[0] == '#') {
+         char           *ecp;
+         int             uid;
++
+         uid = strtoul(cptr + 1, &ecp, 10);
+         if (*ecp != 0) {
+             config_perror("Bad number");
+@@ -129,44 +126,47 @@ snmpd_set_agent_user(const char *token, char *cptr)
+ 	    netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+ 			       NETSNMP_DS_AGENT_USERID, uid);
+ 	}
+-    }
+ #if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H)
+-    else if ((info = getpwnam(cptr)) != NULL) {
+-        netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+-			   NETSNMP_DS_AGENT_USERID, info->pw_uid);
+     } else {
+-        config_perror("User not found in passwd database");
+-    }
+-    endpwent();
++        struct passwd  *info;
++
++        info = getpwnam(cptr);
++        if (info)
++            netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
++                               NETSNMP_DS_AGENT_USERID, info->pw_uid);
++        else
++            config_perror("User not found in passwd database");
++        endpwent();
+ #endif
++    }
+ }
+ 
+ void
+ snmpd_set_agent_group(const char *token, char *cptr)
+ {
+-#if defined(HAVE_GETGRNAM) && defined(HAVE_GRP_H)
+-    struct group   *info;
+-#endif
+-
+     if (cptr[0] == '#') {
+         char           *ecp;
+         int             gid = strtoul(cptr + 1, &ecp, 10);
++
+         if (*ecp != 0) {
+             config_perror("Bad number");
+ 	} else {
+             netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+ 			       NETSNMP_DS_AGENT_GROUPID, gid);
+ 	}
+-    }
+ #if defined(HAVE_GETGRNAM) && defined(HAVE_GRP_H)
+-    else if ((info = getgrnam(cptr)) != NULL) {
+-        netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
+-			   NETSNMP_DS_AGENT_GROUPID, info->gr_gid);
+     } else {
+-        config_perror("Group not found in group database");
+-    }
+-    endpwent();
++        struct group   *info;
++
++        info = getgrnam(cptr);
++        if (info)
++            netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, 
++                               NETSNMP_DS_AGENT_GROUPID, info->gr_gid);
++        else
++            config_perror("Group not found in group database");
++        endgrent();
+ #endif
++    }
+ }
+ #endif
+ 
+@@ -187,9 +187,10 @@ snmpd_set_agent_address(const char *token, char *cptr)
+         /*
+          * append to the older specification string 
+          */
+-        snprintf(buf, SPRINT_MAX_LEN, "%s,%s", ptr, cptr);
++        snprintf(buf, sizeof(buf), "%s,%s", ptr, cptr);
++	buf[sizeof(buf) - 1] = '\0';
+     } else {
+-        strncpy(buf, cptr, SPRINT_MAX_LEN);
++        strlcpy(buf, cptr, sizeof(buf));
+     }
+ 
+     DEBUGMSGTL(("snmpd_ports", "port spec: %s\n", buf));
+diff --git a/agent/agent_registry.c b/agent/agent_registry.c
+index 5efaeb5..1e2482a 100644
+--- a/agent/agent_registry.c
++++ b/agent/agent_registry.c
+@@ -555,6 +555,8 @@ netsnmp_subtree_change_prev(netsnmp_subtree *ptr, netsnmp_subtree *theprev)
+                                &ptr->oid_off);
+ }
+ 
++netsnmp_feature_child_of(netsnmp_subtree_compare,netsnmp_unused)
++#ifndef NETSNMP_FEATURE_REMOVE_NETSNMP_SUBTREE_COMPARE
+ /** Compares OIDs of given subtrees.
+  *
+  *  @param ap,bp Pointers to the subtrees to be compared.
+@@ -563,8 +565,6 @@ netsnmp_subtree_change_prev(netsnmp_subtree *ptr, netsnmp_subtree *theprev)
+  *
+  *  @see snmp_oid_compare()
+  */
+-netsnmp_feature_child_of(netsnmp_subtree_compare,netsnmp_unused)
+-#ifndef NETSNMP_FEATURE_REMOVE_NETSNMP_SUBTREE_COMPARE
+ int
+ netsnmp_subtree_compare(const netsnmp_subtree *ap, const netsnmp_subtree *bp)
+ {
+@@ -742,7 +742,7 @@ netsnmp_subtree_split(netsnmp_subtree *current, oid name[], int name_len)
+ 
+ /** Loads the subtree under given context name.
+  *
+- *  @param root The subtree to be loaded into current subtree.
++ *  @param new_sub The subtree to be loaded into current subtree.
+  *
+  *  @param context_name Text name of the context we're searching for.
+  *
+@@ -1085,8 +1085,22 @@ netsnmp_subtree_find(const oid *name, size_t len, netsnmp_subtree *subtree,
+ 
+ /** Registers a MIB handler.
+  *
++ *  @param moduleName
++ *  @param var
++ *  @param varsize
++ *  @param numvars
++ *  @param  mibloc
++ *  @param mibloclen
++ *  @param priority
++ *  @param range_subid
++ *  @param range_ubound
++ *  @param  ss
++ *  @param context
++ *  @param timeout
++ *  @param flags
+  *  @param reginfo Registration handler structure.
+  *                 In a case of failure, it will be freed.
++ *  @param perform_callback
+  *
+  *  @return gives MIB_REGISTERED_OK or MIB_* error code.
+  *
+@@ -1389,6 +1403,7 @@ register_mib_detach(void)
+  *                     If range_subid is zero, then this parameter is ignored.
+  *
+  *  @param ss 
++ *  @param context
+  *  @param timeout 
+  *  @param flags 
+  *
+@@ -1584,6 +1599,7 @@ netsnmp_subtree_unload(netsnmp_subtree *sub, netsnmp_subtree *prev, const char *
+         DEBUGMSGOID(("register_mib", sub->start_a, sub->start_len));
+     } else {
+         DEBUGMSG(("register_mib", "[NIL]"));
++        return;
+     }
+     DEBUGMSG(("register_mib", ", "));
+     if (prev != NULL) {
+@@ -1664,7 +1680,7 @@ unregister_mib_context(oid * name, size_t len, int priority,
+                        int range_subid, oid range_ubound,
+                        const char *context)
+ {
+-    netsnmp_subtree *list, *myptr;
++    netsnmp_subtree *list, *myptr = NULL;
+     netsnmp_subtree *prev, *child, *next; /* loop through children */
+     struct register_parameters reg_parms;
+     int old_lookup_cache_val = netsnmp_get_lookup_cache_size();
+diff --git a/agent/agent_trap.c b/agent/agent_trap.c
+index cc90620..dfa9dcf 100644
+--- a/agent/agent_trap.c
++++ b/agent/agent_trap.c
+@@ -801,6 +801,7 @@ netsnmp_send_traps(int trap, int specific,
+ 
+     }
+ 
++    if (template_v2pdu) {
+ 	/* A context name was provided, so copy it and its length to the v2 pdu
+ 	 * template. */
+ 	if (context != NULL)
+@@ -808,6 +809,7 @@ netsnmp_send_traps(int trap, int specific,
+ 		template_v2pdu->contextName    = strdup(context);
+ 		template_v2pdu->contextNameLen = strlen(context);
+ 	}
++    }
+ 
+     /*
+      *  Now loop through the list of trap sinks
+diff --git a/agent/auto_nlist.c b/agent/auto_nlist.c
+index cb92a5b..bcbdb05 100644
+--- a/agent/auto_nlist.c
++++ b/agent/auto_nlist.c
+@@ -52,6 +52,9 @@ auto_nlist_value(const char *string)
+         }
+     }
+     if (*ptr == 0) {
++#if !(defined(aix4) || defined(aix5) || defined(aix6) || defined(aix7))
++        static char *n_name = NULL;
++#endif
+         *ptr = (struct autonlist *) malloc(sizeof(struct autonlist));
+         it = *ptr;
+         it->left = 0;
+@@ -66,15 +69,35 @@ auto_nlist_value(const char *string)
+         strcpy(it->nl[0].n_name, string);
+         it->nl[0].n_name[strlen(string)+1] = '\0';
+ #else
+-        sprintf(it->nl[0].n_name, "_%s", string);
++
++        if (n_name != NULL)
++            free(n_name);
++
++        n_name = malloc(strlen(string) + 2);
++        if (n_name == NULL) {
++            snmp_log(LOG_ERR, "nlist err: failed to allocate memory");
++            return (-1);
++        }
++        snprintf(n_name, strlen(string) + 2, "_%s", string);
++        it->nl[0].n_name = (const char*)n_name;
+ #endif
+         it->nl[1].n_name = 0;
+         init_nlist(it->nl);
+ #if !(defined(aix4) || defined(aix5) || defined(aix6) || defined(aix7) || \
+-                    defined(netbsd1) || defined(dragonfly)) 
++                    defined(netbsd1) || defined(dragonfly))
+         if (it->nl[0].n_type == 0) {
+-            strcpy(it->nl[0].n_name, string);
+-            it->nl[0].n_name[strlen(string)+1] = '\0';
++            static char *n_name2 = NULL;
++
++            if (n_name2 != NULL)
++                free(n_name2);
++
++            n_name2 = malloc(strlen(string) + 1);
++            if (n_name2 == NULL) {
++                snmp_log(LOG_ERR, "nlist err: failed to allocate memory");
++                return (-1);
++            }
++            strcpy(n_name2, string);
++            it->nl[0].n_name = (const char*)n_name2;
+             init_nlist(it->nl);
+         }
+ #endif
+@@ -86,7 +109,8 @@ auto_nlist_value(const char *string)
+ 	    }
+             return (-1);
+         } else {
+-            DEBUGMSGTL(("auto_nlist:auto_nlist_value", "found symbol %s at %x.\n",
++            DEBUGMSGTL(("auto_nlist:auto_nlist_value",
++			"found symbol %s at %lx.\n",
+                         it->symbol, it->nl[0].n_value));
+             return (it->nl[0].n_value);
+         }
+@@ -95,7 +119,7 @@ auto_nlist_value(const char *string)
+ }
+ 
+ int
+-auto_nlist(const char *string, char *var, int size)
++auto_nlist(const char *string, char *var, size_t size)
+ {
+     long            result;
+     int             ret;
+@@ -192,7 +216,7 @@ init_nlist(struct nlist nl[])
+ }
+ 
+ int
+-KNLookup(struct nlist nl[], int nl_which, char *buf, int s)
++KNLookup(struct nlist nl[], int nl_which, char *buf, size_t s)
+ {
+     struct nlist   *nlp = &nl[nl_which];
+ 
+diff --git a/agent/helpers/all_helpers.c b/agent/helpers/all_helpers.c
+index 0f2b6a1..e1e1b78 100644
+--- a/agent/helpers/all_helpers.c
++++ b/agent/helpers/all_helpers.c
+@@ -26,7 +26,7 @@ netsnmp_init_helpers(void)
+     netsnmp_init_bulk_to_next_helper();
+ #ifndef NETSNMP_FEATURE_REMOVE_TABLE_DATASET
+     netsnmp_init_table_dataset();
+-#endif
++#endif /* NETSNMP_FEATURE_REMOVE_TABLE_DATASET */
+ 
+ #ifndef NETSNMP_FEATURE_REMOVE_ROW_MERGE
+     netsnmp_init_row_merge();
+diff --git a/agent/helpers/instance.c b/agent/helpers/instance.c
+index 2142909..a187d58 100644
+--- a/agent/helpers/instance.c
++++ b/agent/helpers/instance.c
+@@ -536,6 +536,8 @@ netsnmp_register_num_file_instance(const char *name,
+ }
+ #endif /* NETSNMP_FEATURE_REMOVE_REGISTER_NUM_FILE_INSTANCE */
+ 
++netsnmp_feature_child_of(register_int_instance,instance)
++#ifndef NETSNMP_FEATURE_REMOVE_REGISTER_INT_INSTANCE
+ /**
+  * This function registers an int helper handler to a specified OID.
+  *
+@@ -554,8 +556,6 @@ netsnmp_register_num_file_instance(const char *name,
+  *      MIB_REGISTERED_OK is returned if the registration was a success.
+  *	Failures are MIB_REGISTRATION_FAILED and MIB_DUPLICATE_REGISTRATION.
+  */
+-netsnmp_feature_child_of(register_int_instance,instance)
+-#ifndef NETSNMP_FEATURE_REMOVE_REGISTER_INT_INSTANCE
+ int
+ netsnmp_register_int_instance(const char *name,
+                               const oid * reg_oid, size_t reg_oid_len,
+diff --git a/agent/helpers/old_api.c b/agent/helpers/old_api.c
+index b1630e6..4888cbc 100644
+--- a/agent/helpers/old_api.c
++++ b/agent/helpers/old_api.c
+@@ -103,8 +103,12 @@ netsnmp_register_old_api(const char *moduleName,
+         reginfo->rootoid_len = (mibloclen + vp->namelen);
+         reginfo->rootoid =
+             (oid *) malloc(reginfo->rootoid_len * sizeof(oid));
+-        if (reginfo->rootoid == NULL)
++        if (reginfo->rootoid == NULL) {
++            SNMP_FREE(vp);
++            SNMP_FREE(reginfo->handlerName);
++            SNMP_FREE(reginfo);
+             return SNMP_ERR_GENERR;
++        }
+ 
+         memcpy(reginfo->rootoid, mibloc, mibloclen * sizeof(oid));
+         memcpy(reginfo->rootoid + mibloclen, vp->name, vp->namelen
+@@ -127,7 +131,7 @@ netsnmp_register_old_api(const char *moduleName,
+          */
+         if (netsnmp_register_handler(reginfo) != MIB_REGISTERED_OK) {
+             /** netsnmp_handler_registration_free(reginfo); already freed */
+-            SNMP_FREE(vp);
++            /* SNMP_FREE(vp); already freed */
+         }
+     }
+     return SNMPERR_SUCCESS;
+diff --git a/agent/helpers/snmp_get_statistic.c b/agent/helpers/snmp_get_statistic.c
+index 2e4fed8..efac2ac 100644
+--- a/agent/helpers/snmp_get_statistic.c
++++ b/agent/helpers/snmp_get_statistic.c
+@@ -58,4 +58,4 @@ netsnmp_register_statistic_handler(netsnmp_handler_registration *reginfo,
+ }
+ #else /* !NETSNMP_FEATURE_REMOVE_HELPER_GET_STATISTICS */
+ netsnmp_feature_unused(helper_statistics);
+-#endif
++#endif /* !NETSNMP_FEATURE_REMOVE_HELPER_GET_STATISTICS */
+diff --git a/agent/helpers/table_array.c b/agent/helpers/table_array.c
+index 49e0b24..7c98aae 100644
+--- a/agent/helpers/table_array.c
++++ b/agent/helpers/table_array.c
+@@ -576,8 +576,11 @@ group_requests(netsnmp_agent_request_info *agtreq_info,
+         DEBUGMSG(("table_array:group", "\n"));
+         g = SNMP_MALLOC_TYPEDEF(netsnmp_request_group);
+         i = SNMP_MALLOC_TYPEDEF(netsnmp_request_group_item);
+-        if (i == NULL || g == NULL)
++        if (i == NULL || g == NULL) {
++            SNMP_FREE(i);
++            SNMP_FREE(g);
+             return;
++        }
+         g->list = i;
+         g->table = tad->table;
+         i->ri = current;
+diff --git a/agent/helpers/table_dataset.c b/agent/helpers/table_dataset.c
+index 5160748..0949a8a 100644
+--- a/agent/helpers/table_dataset.c
++++ b/agent/helpers/table_dataset.c
+@@ -467,7 +467,7 @@ netsnmp_register_table_data_set(netsnmp_handler_registration *reginfo,
+                            netsnmp_get_table_data_set_handler(data_set));
+     ret = netsnmp_register_table_data(reginfo, data_set->table,
+                                        table_info);
+-    if (reginfo->handler)
++    if (ret == SNMPERR_SUCCESS && reginfo->handler)
+         netsnmp_handler_owns_table_info(reginfo->handler->next);
+     return ret;
+ }
+@@ -1105,9 +1105,11 @@ netsnmp_config_parse_table_set(const char *token, char *line)
+         switch (tp->access) {
+         case MIB_ACCESS_CREATE:
+             table_set->allow_creation = 1;
++            /* fallthrough */
+         case MIB_ACCESS_READWRITE:
+         case MIB_ACCESS_WRITEONLY:
+             canwrite = 1;
++            /* fallthrough */
+         case MIB_ACCESS_READONLY:
+             DEBUGMSGTL(("table_set_add_table",
+                         "adding column %ld of type %d\n", tp->subid, type));
+diff --git a/agent/helpers/table_iterator.c b/agent/helpers/table_iterator.c
+index 64ef2cb..8ed5cd0 100644
+--- a/agent/helpers/table_iterator.c
++++ b/agent/helpers/table_iterator.c
+@@ -648,6 +648,8 @@ netsnmp_table_iterator_helper_handler(netsnmp_mib_handler *handler,
+                          */
+                         if (free_this_index_search)
+                             snmp_free_varbind(free_this_index_search);
++                        netsnmp_free_request_data_sets(reqtmp);
++                        SNMP_FREE(reqtmp);
+                         return SNMP_ERR_GENERR;
+                     }
+                     coloid[reginfo->rootoid_len + 1] = table_info->colnum;
+@@ -681,6 +683,8 @@ netsnmp_table_iterator_helper_handler(netsnmp_mib_handler *handler,
+                                 if (free_this_index_search)
+                                     snmp_free_varbind
+                                         (free_this_index_search);
++                                netsnmp_free_request_data_sets(reqtmp);
++                                SNMP_FREE(reqtmp);
+                                 return SNMP_ERR_GENERR;
+                             }
+                             request_count--;   /* One less to look for */
+diff --git a/agent/helpers/watcher.c b/agent/helpers/watcher.c
+index ee80736..9b3933b 100644
+--- a/agent/helpers/watcher.c
++++ b/agent/helpers/watcher.c
+@@ -245,14 +245,11 @@ netsnmp_watcher_helper_handler(netsnmp_mib_handler *handler,
+     netsnmp_watcher_cache *old_data;
+ 
+     DEBUGMSGTL(("helper:watcher", "Got request:  %d\n", reqinfo->mode));
+-
+     DEBUGMSGTL(( "helper:watcher", "  oid:"));
+     DEBUGMSGOID(("helper:watcher", requests->requestvb->name,
+                                    requests->requestvb->name_length));
+     DEBUGMSG((   "helper:watcher", "\n"));
+ 
+-
+-
+     switch (reqinfo->mode) {
+         /*
+          * data requests 
+@@ -392,14 +389,11 @@ netsnmp_watched_timestamp_handler(netsnmp_mib_handler *handler,
+ 
+     DEBUGMSGTL(("helper:watcher:timestamp",
+                                "Got request:  %d\n", reqinfo->mode));
+-
+     DEBUGMSGTL(( "helper:watcher:timestamp", "  oid:"));
+     DEBUGMSGOID(("helper:watcher:timestamp", requests->requestvb->name,
+                                    requests->requestvb->name_length));
+     DEBUGMSG((   "helper:watcher:timestamp", "\n"));
+ 
+-
+-
+     switch (reqinfo->mode) {
+         /*
+          * data requests 
+@@ -481,14 +475,11 @@ netsnmp_watched_spinlock_handler(netsnmp_mib_handler *handler,
+ 
+     DEBUGMSGTL(("helper:watcher:spinlock",
+                                "Got request:  %d\n", reqinfo->mode));
+-
+     DEBUGMSGTL(( "helper:watcher:spinlock", "  oid:"));
+     DEBUGMSGOID(("helper:watcher:spinlock", requests->requestvb->name,
+                                    requests->requestvb->name_length));
+     DEBUGMSG((   "helper:watcher:spinlock", "\n"));
+ 
+-
+-
+     switch (reqinfo->mode) {
+         /*
+          * Ensure the assigned value matches the current one
+diff --git a/agent/mibgroup/Rmon/agutil.c b/agent/mibgroup/Rmon/agutil.c
+index d28bb67..12c6342 100644
+--- a/agent/mibgroup/Rmon/agutil.c
++++ b/agent/mibgroup/Rmon/agutil.c
+@@ -200,12 +200,7 @@ AGUTIL_get_oid_value(u_char * var_val, u_char var_val_type,
+ u_long
+ AGUTIL_sys_up_time(void)
+ {
+-    struct timeval  current, delta;
+-    const struct timeval* const starttime_ptr = netsnmp_get_agent_starttime();
+-
+-    gettimeofday(&current, NULL);
+-    NETSNMP_TIMERSUB(&current, starttime_ptr, &delta);
+-    return delta.tv_sec * 100 + delta.tv_usec / 10000;
++    return netsnmp_get_agent_runtime();
+ }
+ 
+ /*
+diff --git a/agent/mibgroup/Rmon/event.c b/agent/mibgroup/Rmon/event.c
+index 008ebaa..04a8555 100644
+--- a/agent/mibgroup/Rmon/event.c
++++ b/agent/mibgroup/Rmon/event.c
+@@ -128,6 +128,7 @@ typedef struct {
+ 
+ static TABLE_DEFINTION_T EventCtrlTable;
+ static TABLE_DEFINTION_T *table_ptr = &EventCtrlTable;
++static unsigned char zero_octet_string[1];
+ 
+ /*
+  * Control Table RowApi Callbacks 
+@@ -262,7 +263,6 @@ write_eventControl(int action, u_char * var_val, u_char var_val_type,
+     static int      prev_action = COMMIT;
+     RMON_ENTRY_T   *hdr;
+     CRTL_ENTRY_T   *cloned_body;
+-    CRTL_ENTRY_T   *body;
+ 
+     switch (action) {
+     case RESERVE1:
+@@ -283,7 +283,6 @@ write_eventControl(int action, u_char * var_val, u_char var_val_type,
+         leaf_id = (int) name[eventEntryFirstIndexBegin - 1];
+         hdr = ROWAPI_find(table_ptr, long_temp);        /* it MUST be OK */
+         cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+-        body = (CRTL_ENTRY_T *) hdr->body;
+         switch (leaf_id) {
+         case Leaf_event_description:
+             char_temp = AGMALLOC(1 + MAX_event_description);
+@@ -406,7 +405,7 @@ var_eventTable(struct variable *vp,
+             return (unsigned char *) theEntry.event_description;
+         } else {
+             *var_len = 0;
+-            return NETSNMP_REMOVE_CONST(unsigned char *, "");
++            return zero_octet_string;
+         }
+     case EVENTTYPE:
+         long_ret = theEntry.event_type;
+@@ -417,7 +416,7 @@ var_eventTable(struct variable *vp,
+             return (unsigned char *) theEntry.event_community;
+         } else {
+             *var_len = 0;
+-            return NETSNMP_REMOVE_CONST(unsigned char *, "");
++            return zero_octet_string;
+         }
+     case EVENTLASTTIMESENT:
+         long_ret = theEntry.event_last_time_sent;
+@@ -428,7 +427,7 @@ var_eventTable(struct variable *vp,
+             return (unsigned char *) hdr->owner;
+         } else {
+             *var_len = 0;
+-            return NETSNMP_REMOVE_CONST(unsigned char *, "");
++            return zero_octet_string;
+         }
+     case EVENTSTATUS:
+         long_ret = hdr->status;
+@@ -457,7 +456,6 @@ var_logTable(struct variable *vp,
+     static long     long_ret;
+     static DATA_ENTRY_T theEntry;
+     RMON_ENTRY_T   *hdr;
+-    CRTL_ENTRY_T   *ctrl;
+ 
+     *write_method = NULL;
+     hdr = ROWDATAAPI_header_DataEntry(vp, name, length, exact, var_len,
+@@ -467,8 +465,6 @@ var_logTable(struct variable *vp,
+     if (!hdr)
+         return NULL;
+ 
+-    ctrl = (CRTL_ENTRY_T *) hdr->body;
+-
+     *var_len = sizeof(long);    /* default */
+ 
+     switch (vp->magic) {
+@@ -487,7 +483,7 @@ var_logTable(struct variable *vp,
+             return (unsigned char *) theEntry.log_description;
+         } else {
+             *var_len = 0;
+-            return NETSNMP_REMOVE_CONST(unsigned char *, "");
++            return zero_octet_string;
+         }
+     default:
+         ERROR_MSG("");
+diff --git a/agent/mibgroup/Rmon/history.c b/agent/mibgroup/Rmon/history.c
+index b962567..c8e9c25 100644
+--- a/agent/mibgroup/Rmon/history.c
++++ b/agent/mibgroup/Rmon/history.c
+@@ -181,7 +181,7 @@ write_historyControl(int action, u_char * var_val, u_char var_val_type,
+                                                var_val_len,
+                                                MIN_historyControlBucketsRequested,
+                                                MAX_historyControlBucketsRequested,
+-                                               &cloned_body->scrlr.
++                                               (long *) &cloned_body->scrlr.
+                                                data_requested);
+             if (SNMP_ERR_NOERROR != snmp_status) {
+                 return snmp_status;
+@@ -198,7 +198,7 @@ write_historyControl(int action, u_char * var_val, u_char var_val_type,
+                                                var_val_len,
+                                                MIN_historyControlInterval,
+                                                MAX_historyControlInterval,
+-                                               &cloned_body->interval);
++                                               (long *) &cloned_body->interval);
+             if (SNMP_ERR_NOERROR != snmp_status) {
+                 return snmp_status;
+             }
+@@ -257,6 +257,7 @@ var_historyControlTable(struct variable *vp,
+                         int exact,
+                         size_t * var_len, WriteMethod ** write_method)
+ {
++    static unsigned char zero_octet_string[1];
+     static long     long_ret;
+     static CRTL_ENTRY_T theEntry;
+     RMON_ENTRY_T   *hdr;
+@@ -298,7 +299,7 @@ var_historyControlTable(struct variable *vp,
+             return (unsigned char *) hdr->owner;
+         } else {
+             *var_len = 0;
+-            return NETSNMP_REMOVE_CONST(unsigned char *, "");
++            return zero_octet_string;
+         }
+ 
+     case CTRL_STATUS:
+@@ -530,7 +531,6 @@ var_etherHistoryTable(struct variable *vp,
+     static long     long_ret;
+     static DATA_ENTRY_T theBucket;
+     RMON_ENTRY_T   *hdr;
+-    CRTL_ENTRY_T   *ctrl;
+ 
+     *write_method = NULL;
+     hdr = ROWDATAAPI_header_DataEntry(vp, name, length, exact, var_len,
+@@ -542,8 +542,6 @@ var_etherHistoryTable(struct variable *vp,
+ 
+     *var_len = sizeof(long);    /* default */
+ 
+-    ctrl = (CRTL_ENTRY_T *) hdr->body;
+-
+     switch (vp->magic) {
+     case DATA_INDEX:
+         long_ret = hdr->ctrl_index;
+diff --git a/agent/mibgroup/Rmon/row_api.h b/agent/mibgroup/Rmon/row_api.h
+index 2fb5a88..9f576be 100644
+--- a/agent/mibgroup/Rmon/row_api.h
++++ b/agent/mibgroup/Rmon/row_api.h
+@@ -62,7 +62,7 @@ typedef struct tagEntry {
+ typedef int     (ENTRY_CALLBACK_T) (RMON_ENTRY_T *);
+ 
+ typedef struct {
+-    char           *name;
++    const char     *name;
+     RMON_ENTRY_T   *first;
+     u_long          max_number_of_entries;      /* '<0' means without limit */
+     u_long          current_number_of_entries;
+diff --git a/agent/mibgroup/Rmon/statistics.c b/agent/mibgroup/Rmon/statistics.c
+index 51f25ee..3ed4acb 100644
+--- a/agent/mibgroup/Rmon/statistics.c
++++ b/agent/mibgroup/Rmon/statistics.c
+@@ -317,6 +317,7 @@ var_etherStatsEntry(struct variable * vp, oid * name, size_t * length,
+                     int exact, size_t * var_len,
+                     WriteMethod ** write_method)
+ {
++    static unsigned char zero_octet_string[1];
+     static long     long_return;
+     static CRTL_ENTRY_T theEntry;
+     RMON_ENTRY_T   *hdr;
+@@ -397,7 +398,7 @@ var_etherStatsEntry(struct variable * vp, oid * name, size_t * length,
+             return (unsigned char *) hdr->owner;
+         } else {
+             *var_len = 0;
+-            return NETSNMP_REMOVE_CONST(unsigned char *, "");
++            return zero_octet_string;
+         }
+     case IDetherStatsStatus:
+         long_return = hdr->status;
+diff --git a/agent/mibgroup/agent/extend.c b/agent/mibgroup/agent/extend.c
+index ddef4fb..8268559 100644
+--- a/agent/mibgroup/agent/extend.c
++++ b/agent/mibgroup/agent/extend.c
+@@ -120,7 +120,8 @@ _register_extend( oid *base, size_t len )
+     netsnmp_table_data                *dinfo;
+     netsnmp_table_registration_info   *tinfo;
+     netsnmp_watcher_info              *winfo;
+-    netsnmp_handler_registration      *reg;
++    netsnmp_handler_registration      *reg = NULL;
++    int                                rc;
+ 
+     for ( eptr=ereg_head; eptr; eptr=eptr->next ) {
+         if (!snmp_oid_compare( base, len, eptr->root_oid, eptr->oid_len))
+@@ -128,6 +129,8 @@ _register_extend( oid *base, size_t len )
+     }
+     if (!eptr) {
+         eptr = SNMP_MALLOC_TYPEDEF( extend_registration_block );
++        if (!eptr)
++            return NULL;
+         eptr->root_oid = snmp_duplicate_objid( base, len );
+         eptr->oid_len  = len;
+         eptr->num_entries = 0;
+@@ -157,7 +160,10 @@ _register_extend( oid *base, size_t len )
+                 "nsExtendConfigTable", handle_nsExtendConfigTable, 
+                 oid_buf, len+1, HANDLER_CAN_RONLY);
+ #endif /* !NETSNMP_NO_WRITE_SUPPORT */
+-    netsnmp_register_table_data( reg, dinfo, tinfo );
++    rc = netsnmp_register_table_data( reg, dinfo, tinfo );
++    if (rc != SNMPERR_SUCCESS) {
++        goto bail;
++    }
+     netsnmp_handler_owns_table_info(reg->handler->next);
+     eptr->reg[0] = reg;
+ 
+@@ -175,7 +181,9 @@ _register_extend( oid *base, size_t len )
+     reg   = netsnmp_create_handler_registration(
+                 "nsExtendOut1Table", handle_nsExtendOutput1Table, 
+                 oid_buf, len+1, HANDLER_CAN_RONLY);
+-    netsnmp_register_table_data( reg, dinfo, tinfo );
++    rc = netsnmp_register_table_data( reg, dinfo, tinfo );
++    if (rc != SNMPERR_SUCCESS)
++        goto bail;
+     netsnmp_handler_owns_table_info(reg->handler->next);
+     eptr->reg[1] = reg;
+ 
+@@ -195,7 +203,9 @@ _register_extend( oid *base, size_t len )
+     reg   = netsnmp_create_handler_registration(
+                 "nsExtendOut2Table", handle_nsExtendOutput2Table, 
+                 oid_buf, len+1, HANDLER_CAN_RONLY);
+-    netsnmp_register_table( reg, tinfo );
++    rc = netsnmp_register_table( reg, tinfo );
++    if (rc != SNMPERR_SUCCESS)
++        goto bail;
+     netsnmp_handler_owns_table_info(reg->handler->next);
+     eptr->reg[2] = reg;
+ 
+@@ -209,9 +219,20 @@ _register_extend( oid *base, size_t len )
+     winfo = netsnmp_create_watcher_info(
+                 &(eptr->num_entries), sizeof(eptr->num_entries),
+                 ASN_INTEGER, WATCHER_FIXED_SIZE);
+-    netsnmp_register_watched_scalar2( reg, winfo );
++    rc = netsnmp_register_watched_scalar2( reg, winfo );
++    if (rc != SNMPERR_SUCCESS)
++        goto bail;
+ 
+     return eptr;
++
++bail:
++    if (eptr->reg[2])
++        netsnmp_unregister_handler(eptr->reg[2]);
++    if (eptr->reg[1])
++        netsnmp_unregister_handler(eptr->reg[1]);
++    if (eptr->reg[0])
++        netsnmp_unregister_handler(eptr->reg[0]);
++    return NULL;
+ }
+ 
+ static void
+@@ -406,9 +427,9 @@ _free_extension( netsnmp_extend *extension, extend_registration_block *ereg )
+             eprev->next = eptr->next;
+         else
+             ereg->ehead = eptr->next;
++        netsnmp_table_data_remove_and_delete_row( ereg->dinfo, extension->row);
+     }
+ 
+-    netsnmp_table_data_remove_and_delete_row( ereg->dinfo, extension->row);
+     SNMP_FREE( extension->token );
+     SNMP_FREE( extension->cache );
+     SNMP_FREE( extension->command );
+diff --git a/agent/mibgroup/agent/nsDebug.c b/agent/mibgroup/agent/nsDebug.c
+index 0a629cc..89a90b0 100644
+--- a/agent/mibgroup/agent/nsDebug.c
++++ b/agent/mibgroup/agent/nsDebug.c
+@@ -423,8 +423,9 @@ handle_nsDebugTable(netsnmp_mib_handler *handler,
+ 		 */
+                 debug_entry = (netsnmp_token_descr*)
+                                netsnmp_extract_iterator_context(request);
+-                debug_entry->enabled =
+-                    (*request->requestvb->val.integer == RS_ACTIVE);
++                if (debug_entry)
++                    debug_entry->enabled =
++                        (*request->requestvb->val.integer == RS_ACTIVE);
+ 		break;
+ 
+             case RS_CREATEANDWAIT:
+diff --git a/agent/mibgroup/agent/nsLogging.c b/agent/mibgroup/agent/nsLogging.c
+index c06a18a..7f20bdb 100644
+--- a/agent/mibgroup/agent/nsLogging.c
++++ b/agent/mibgroup/agent/nsLogging.c
+@@ -363,7 +363,7 @@ handle_nsLoggingTable(netsnmp_mib_handler *handler,
+ 		switch ( *request->requestvb->val.integer ) {
+                 case RS_ACTIVE:
+                 case RS_CREATEANDGO:
+-                    if ( !logh->type ) {
++                    if ( !logh || !logh->type ) {
+                         netsnmp_set_request_error(reqinfo, request,
+                                                   SNMP_ERR_INCONSISTENTVALUE);
+                         return SNMP_ERR_INCONSISTENTVALUE;
+diff --git a/agent/mibgroup/agent/nsVacmAccessTable.c b/agent/mibgroup/agent/nsVacmAccessTable.c
+index 22d2154..79fa97d 100644
+--- a/agent/mibgroup/agent/nsVacmAccessTable.c
++++ b/agent/mibgroup/agent/nsVacmAccessTable.c
+@@ -174,11 +174,11 @@ nsVacmAccessTable_handler(netsnmp_mib_handler *handler,
+             /* Extract the authType token from the list of indexes */
+             idx = table_info->indexes->next_variable->next_variable->next_variable->next_variable;
+             memset(atype, 0, sizeof(atype));
+-            strncpy(atype, (char *)idx->val.string, idx->val_len);
++            memcpy(atype, (char *)idx->val.string, idx->val_len);
+             viewIdx = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, atype);
+             DEBUGMSGTL(("nsVacm", "GET %s (%d)\n", idx->val.string, viewIdx));
+ 
+-            if (!entry)
++            if (!entry || viewIdx < 0)
+                 continue;
+ 
+             switch (table_info->colnum) {
+@@ -248,7 +248,7 @@ nsVacmAccessTable_handler(netsnmp_mib_handler *handler,
+                  */
+                 idx = table_info->indexes->next_variable->next_variable->next_variable->next_variable;
+                 memset(atype, 0, sizeof(atype));
+-                strncpy(atype, (char *)idx->val.string, idx->val_len);
++                memcpy(atype, (char *)idx->val.string, idx->val_len);
+                 viewIdx = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, atype);
+                 if ( viewIdx < 0 ) {
+                     ret = SNMP_ERR_NOCREATION;
+@@ -322,8 +322,10 @@ nsVacmAccessTable_handler(netsnmp_mib_handler *handler,
+             /* Extract the authType token from the list of indexes */
+             idx = table_info->indexes->next_variable->next_variable->next_variable->next_variable;
+             memset(atype, 0, sizeof(atype));
+-            strncpy(atype, (char *)idx->val.string, idx->val_len);
++            memcpy(atype, (char *)idx->val.string, idx->val_len);
+             viewIdx = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, atype);
++            if (viewIdx < 0)
++                    continue;
+ 
+             switch (table_info->colnum) {
+             case COLUMN_NSVACMCONTEXTMATCH:
+diff --git a/agent/mibgroup/agentx/agentx_config.c b/agent/mibgroup/agentx/agentx_config.c
+index b590c7a..ea453c2 100644
+--- a/agent/mibgroup/agentx/agentx_config.c
++++ b/agent/mibgroup/agentx/agentx_config.c
+@@ -180,10 +180,8 @@ agentx_config_init(void)
+      */
+     netsnmp_register_default_domain("agentx", "unix tcp");
+     netsnmp_register_default_target("agentx", "unix", NETSNMP_AGENTX_SOCKET);
+-#define val(x) __STRING(x)
+     netsnmp_register_default_target("agentx", "tcp",
+-                                    "localhost:" val(AGENTX_PORT));
+-#undef val
++                                    "localhost:" __STRING(AGENTX_PORT));
+     agentx_register_config_handler("agentxsocket",
+                                   agentx_parse_agentx_socket, NULL,
+                                   "AgentX bind address");
+diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c
+index 3f4b33d..f16f392 100644
+--- a/agent/mibgroup/agentx/master_admin.c
++++ b/agent/mibgroup/agentx/master_admin.c
+@@ -64,7 +64,6 @@ int
+ open_agentx_session(netsnmp_session * session, netsnmp_pdu *pdu)
+ {
+     netsnmp_session *sp;
+-    struct timeval  now;
+ 
+     DEBUGMSGTL(("agentx/master", "open %8p\n", session));
+     sp = (netsnmp_session *) malloc(sizeof(netsnmp_session));
+@@ -104,8 +103,7 @@ open_agentx_session(netsnmp_session * session, netsnmp_pdu *pdu)
+                                                  name_length);
+     sp->securityAuthProtoLen = pdu->variables->name_length;
+     sp->securityName = strdup((char *) pdu->variables->val.string);
+-    gettimeofday(&now, NULL);
+-    sp->engineTime = calculate_sectime_diff(&now, netsnmp_get_agent_starttime());
++    sp->engineTime = (netsnmp_get_agent_runtime() + 50) / 100;
+ 
+     sp->subsession = session;   /* link back to head */
+     sp->flags |= SNMP_FLAGS_SUBSESSION;
+diff --git a/agent/mibgroup/agentx/protocol.c b/agent/mibgroup/agentx/protocol.c
+index 09c149f..6e3daf3 100644
+--- a/agent/mibgroup/agentx/protocol.c
++++ b/agent/mibgroup/agentx/protocol.c
+@@ -453,6 +453,7 @@ agentx_realloc_build_varbind(u_char ** buf, size_t * buf_len,
+     case ASN_COUNTER:
+     case ASN_GAUGE:
+     case ASN_TIMETICKS:
++    case ASN_UINTEGER:
+         if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+                                       *(vp->val.integer), network_order)) {
+             DEBUGINDENTLESS();
+@@ -1372,6 +1373,7 @@ agentx_parse_varbind(u_char * data, size_t * length, int *type,
+     case ASN_COUNTER:
+     case ASN_GAUGE:
+     case ASN_TIMETICKS:
++    case ASN_UINTEGER:
+         int_val = agentx_parse_int(bufp, network_byte_order);
+         memmove(data_buf, &int_val, 4);
+         *data_len = 4;
+@@ -1429,6 +1431,7 @@ agentx_parse_varbind(u_char * data, size_t * length, int *type,
+         break;
+ 
+     default:
++        DEBUGMSG(("recv", "Can not parse type %x", *type));
+         DEBUGINDENTLESS();
+         return NULL;
+     }
+diff --git a/agent/mibgroup/agentx/subagent.c b/agent/mibgroup/agentx/subagent.c
+index 5d51834..76b1acf 100644
+--- a/agent/mibgroup/agentx/subagent.c
++++ b/agent/mibgroup/agentx/subagent.c
+@@ -243,6 +243,24 @@ free_set_vars(netsnmp_session * ss, netsnmp_pdu *pdu)
+ }
+ #endif /* !NETSNMP_NO_WRITE_SUPPORT */
+ 
++static void
++send_agentx_error(netsnmp_session *session, netsnmp_pdu *pdu, int errstat, int errindex)
++{
++    pdu = snmp_clone_pdu(pdu);
++    pdu->command   = AGENTX_MSG_RESPONSE;
++    pdu->version   = session->version;
++    pdu->errstat   = errstat;
++    pdu->errindex  = errindex;
++    snmp_free_varbind(pdu->variables);
++    pdu->variables = NULL;
++
++    DEBUGMSGTL(("agentx/subagent", "Sending AgentX response error stat %d idx %d\n",
++             errstat, errindex));
++    if (!snmp_send(session, pdu)) {
++        snmp_free_pdu(pdu);
++    }
++}
++
+ int
+ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+                      netsnmp_pdu *pdu, void *magic)
+@@ -298,8 +316,10 @@ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+              * agentx_reopen_session unregisters itself if it succeeds in talking 
+              * to the master agent.  
+              */
+-            snmp_alarm_register(period, SA_REPEAT, agentx_reopen_session,
+-                                NULL);
++            snmp_alarm_register(period, SA_REPEAT, agentx_reopen_session, NULL);
++            snmp_log(LOG_INFO, "AgentX master disconnected us, reconnecting in %d\n", period);
++        } else {
++            snmp_log(LOG_INFO, "AgentX master disconnected us, not reconnecting\n");
+         }
+         return 0;
+     } else if (operation != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+@@ -325,6 +345,7 @@ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+             (ns_subagent_magic *) calloc(1, sizeof(ns_subagent_magic));
+         if (smagic == NULL) {
+             DEBUGMSGTL(("agentx/subagent", "couldn't malloc() smagic\n"));
++            /* would like to send_agentx_error(), but it needs memory too */
+             return 1;
+         }
+         smagic->original_command = pdu->command;
+@@ -389,6 +410,7 @@ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+         if (asi == NULL) {
+             SNMP_FREE(smagic);
+             snmp_log(LOG_WARNING, "save_set_vars() failed\n");
++            send_agentx_error(session, pdu, AGENTX_ERR_PARSE_FAILED, 0);
+             return 1;
+         }
+         asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_RESERVE1;
+@@ -402,6 +424,7 @@ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+         if (asi == NULL) {
+             SNMP_FREE(smagic);
+             snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
++            send_agentx_error(session, pdu, AGENTX_ERR_PROCESSING_ERROR, 0);
+             return 1;
+         }
+         if (asi->mode != SNMP_MSG_INTERNAL_SET_RESERVE2) {
+@@ -409,6 +432,7 @@ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+             snmp_log(LOG_WARNING,
+                      "dropping bad AgentX request (wrong mode %d)\n",
+                      asi->mode);
++            send_agentx_error(session, pdu, AGENTX_ERR_PROCESSING_ERROR, 0);
+             return 1;
+         }
+         asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_ACTION;
+@@ -422,6 +446,7 @@ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+         if (asi == NULL) {
+             SNMP_FREE(smagic);
+             snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
++            send_agentx_error(session, pdu, AGENTX_ERR_PROCESSING_ERROR, 0);
+             return 1;
+         }
+         if (asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE1 ||
+@@ -446,6 +471,7 @@ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+         if (asi == NULL) {
+             SNMP_FREE(smagic);
+             snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
++            send_agentx_error(session, pdu, AGENTX_ERR_PROCESSING_ERROR, 0);
+             return 1;
+         }
+         asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_UNDO;
+@@ -484,6 +510,26 @@ handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+     return 1;
+ }
+ 
++static int
++_invalid_op_and_magic(int op, ns_subagent_magic *smagic)
++{
++    int invalid = 0;
++
++    if (smagic && (snmp_sess_pointer(smagic->session) == NULL ||
++        op == NETSNMP_CALLBACK_OP_TIMED_OUT)) {
++        if (smagic->ovars != NULL) {
++            snmp_free_varbind(smagic->ovars);
++        }
++        free(smagic);
++        invalid = 1;
++    }
++
++    if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE || smagic == NULL)
++        invalid = 1;
++
++    return invalid;
++}
++
+ int
+ handle_subagent_response(int op, netsnmp_session * session, int reqid,
+                          netsnmp_pdu *pdu, void *magic)
+@@ -492,13 +538,7 @@ handle_subagent_response(int op, netsnmp_session * session, int reqid,
+     netsnmp_variable_list *u = NULL, *v = NULL;
+     int             rc = 0;
+ 
+-    if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE || magic == NULL) {
+-        if (op == NETSNMP_CALLBACK_OP_TIMED_OUT && magic != NULL) {
+-            if (smagic->ovars != NULL) {
+-                snmp_free_varbind(smagic->ovars);
+-            }
+-            free(smagic);
+-        }
++    if (_invalid_op_and_magic(op, magic)) {
+         return 1;
+     }
+ 
+@@ -778,6 +818,7 @@ subagent_open_master_session(void)
+ {
+     netsnmp_transport *t;
+     netsnmp_session sess;
++    const char *agentx_socket;
+ 
+     DEBUGMSGTL(("agentx/subagent", "opening session...\n"));
+ 
+@@ -795,9 +836,9 @@ subagent_open_master_session(void)
+     sess.callback = handle_agentx_packet;
+     sess.authenticator = NULL;
+ 
+-    t = netsnmp_transport_open_client(
+-            "agentx", netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+-                                            NETSNMP_DS_AGENT_X_SOCKET));
++    agentx_socket = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
++                                          NETSNMP_DS_AGENT_X_SOCKET);
++    t = netsnmp_transport_open_client("agentx", agentx_socket);
+     if (t == NULL) {
+         /*
+          * Diagnose snmp_open errors with the input
+@@ -806,12 +847,9 @@ subagent_open_master_session(void)
+         if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+                                     NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS)) {
+             char buf[1024];
+-            const char *socket =
+-                netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+-                                      NETSNMP_DS_AGENT_X_SOCKET);
+             snprintf(buf, sizeof(buf), "Warning: "
+                      "Failed to connect to the agentx master agent (%s)",
+-                     socket ? socket : "[NIL]");
++                     agentx_socket ? agentx_socket : "[NIL]");
+             if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+                                         NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+                 netsnmp_sess_log_error(LOG_WARNING, buf, &sess);
+@@ -832,8 +870,7 @@ subagent_open_master_session(void)
+             char buf[1024];
+             snprintf(buf, sizeof(buf), "Error: "
+                      "Failed to create the agentx master agent session (%s)",
+-                     netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+-                                           NETSNMP_DS_AGENT_X_SOCKET));
++                     agentx_socket);
+             snmp_sess_perror(buf, &sess);
+         }
+         netsnmp_transport_free(t);
+diff --git a/agent/mibgroup/disman/event/mteEventConf.c b/agent/mibgroup/disman/event/mteEventConf.c
+index 949d6e5..24192a6 100644
+--- a/agent/mibgroup/disman/event/mteEventConf.c
++++ b/agent/mibgroup/disman/event/mteEventConf.c
+@@ -296,6 +296,11 @@ parse_setEvent( const char *token, char *line )
+     if (cp && *cp == '=') {
+         cp = skip_token( cp );   /* skip the '=' assignment character */
+     }
++    if (!cp) {
++        config_perror("syntax error: missing set value");
++        return;
++    }
++
+     value = strtol( cp, NULL, 0);
+ 
+     /*
+diff --git a/agent/mibgroup/disman/event/mteEventNotificationTable.c b/agent/mibgroup/disman/event/mteEventNotificationTable.c
+index 9095f0e..7d2c94a 100644
+--- a/agent/mibgroup/disman/event/mteEventNotificationTable.c
++++ b/agent/mibgroup/disman/event/mteEventNotificationTable.c
+@@ -98,6 +98,9 @@ mteEventNotificationTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -136,6 +139,9 @@ mteEventNotificationTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             /*
+@@ -204,6 +210,9 @@ mteEventNotificationTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+                 /*
+@@ -225,6 +234,9 @@ mteEventNotificationTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/event/mteEventSetTable.c b/agent/mibgroup/disman/event/mteEventSetTable.c
+index 67a8170..ee696f1 100644
+--- a/agent/mibgroup/disman/event/mteEventSetTable.c
++++ b/agent/mibgroup/disman/event/mteEventSetTable.c
+@@ -100,6 +100,9 @@ mteEventSetTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -151,6 +154,9 @@ mteEventSetTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             /*
+@@ -233,6 +239,9 @@ mteEventSetTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+                 /*
+@@ -254,6 +263,9 @@ mteEventSetTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/event/mteEventTable.c b/agent/mibgroup/disman/event/mteEventTable.c
+index 5603715..c5b534e 100644
+--- a/agent/mibgroup/disman/event/mteEventTable.c
++++ b/agent/mibgroup/disman/event/mteEventTable.c
+@@ -106,6 +106,9 @@ mteEventTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+             if (!entry || !(entry->flags & MTE_EVENT_FLAG_VALID))
+@@ -142,6 +145,9 @@ mteEventTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -223,6 +229,9 @@ mteEventTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_RESERVE2:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -255,6 +264,9 @@ mteEventTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_FREE:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -280,6 +292,9 @@ mteEventTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+@@ -304,6 +319,9 @@ mteEventTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/event/mteObjectsTable.c b/agent/mibgroup/disman/event/mteObjectsTable.c
+index 443c5cc..f7f6e02 100644
+--- a/agent/mibgroup/disman/event/mteObjectsTable.c
++++ b/agent/mibgroup/disman/event/mteObjectsTable.c
+@@ -101,6 +101,9 @@ mteObjectsTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteObject *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -135,6 +138,9 @@ mteObjectsTable_handler(netsnmp_mib_handler *handler,
+     case MODE_SET_RESERVE1:
+ 
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteObject *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -198,8 +204,10 @@ mteObjectsTable_handler(netsnmp_mib_handler *handler,
+         break;
+ 
+     case MODE_SET_RESERVE2:
+-
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -232,8 +240,10 @@ mteObjectsTable_handler(netsnmp_mib_handler *handler,
+         break;
+ 
+     case MODE_SET_FREE:
+-
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -259,6 +269,9 @@ mteObjectsTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteObject *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+                 /*
+@@ -282,6 +295,9 @@ mteObjectsTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteObject *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/event/mteTrigger.c b/agent/mibgroup/disman/event/mteTrigger.c
+index 002b543..7fca1b0 100644
+--- a/agent/mibgroup/disman/event/mteTrigger.c
++++ b/agent/mibgroup/disman/event/mteTrigger.c
+@@ -255,6 +255,7 @@ mteTrigger_run( unsigned int reg, void *clientarg)
+         DEBUGMSGTL(( "disman:event:trigger:monitor", "Trigger query (%s) failed: %d\n",
+                            (( entry->flags & MTE_TRIGGER_FLAG_VWILD ) ? "walk" : "get"), n));
+         _mteTrigger_failure( "failed to run mteTrigger query" );
++        snmp_free_varbind(var);
+         return;
+     }
+ 
+@@ -299,6 +300,7 @@ mteTrigger_run( unsigned int reg, void *clientarg)
+                 if (!vtmp) {
+                     _mteTrigger_failure(
+                           "failed to create mteTrigger temp varbind");
++                    snmp_free_varbind(var);
+                     return;
+                 }
+                 vtmp->type = ASN_NULL;
+@@ -336,6 +338,7 @@ mteTrigger_run( unsigned int reg, void *clientarg)
+                     if (!vtmp) {
+                         _mteTrigger_failure(
+                                  "failed to create mteTrigger temp varbind");
++                        snmp_free_varbind(var);
+                         return;
+                     }
+                     vtmp->type = ASN_NULL;
+@@ -377,6 +380,7 @@ mteTrigger_run( unsigned int reg, void *clientarg)
+                 if (!vtmp) {
+                     _mteTrigger_failure(
+                              "failed to create mteTrigger temp varbind");
++                    snmp_free_varbind(var);
+                     return;
+                 }
+                 vtmp->type = ASN_NULL;
+@@ -712,6 +716,7 @@ mteTrigger_run( unsigned int reg, void *clientarg)
+                         if (!vtmp) {
+                             _mteTrigger_failure(
+                                   "failed to create mteTrigger discontinuity varbind");
++                            snmp_free_varbind(dvar);
+                             return;
+                         }
+                         snmp_set_var_objid(vtmp, entry->mteDeltaDiscontID,
+diff --git a/agent/mibgroup/disman/event/mteTriggerBooleanTable.c b/agent/mibgroup/disman/event/mteTriggerBooleanTable.c
+index a34ad30..ed1ec30 100644
+--- a/agent/mibgroup/disman/event/mteTriggerBooleanTable.c
++++ b/agent/mibgroup/disman/event/mteTriggerBooleanTable.c
+@@ -97,6 +97,9 @@ mteTriggerBooleanTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -105,8 +108,10 @@ mteTriggerBooleanTable_handler(netsnmp_mib_handler *handler,
+              *   rows where the mteTriggerTest 'boolean(1)' bit is set.
+              * So skip entries where this isn't the case.
+              */
+-            if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_BOOLEAN ))
++            if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_BOOLEAN )) {
++                netsnmp_request_set_error(request, SNMP_NOSUCHINSTANCE);
+                 continue;
++            }
+ 
+             switch (tinfo->colnum) {
+             case COLUMN_MTETRIGGERBOOLEANCOMPARISON:
+@@ -152,6 +157,9 @@ mteTriggerBooleanTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -236,6 +244,9 @@ mteTriggerBooleanTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+                 /*
+@@ -256,6 +267,9 @@ mteTriggerBooleanTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/event/mteTriggerDeltaTable.c b/agent/mibgroup/disman/event/mteTriggerDeltaTable.c
+index 47f112c..c2c2e8e 100644
+--- a/agent/mibgroup/disman/event/mteTriggerDeltaTable.c
++++ b/agent/mibgroup/disman/event/mteTriggerDeltaTable.c
+@@ -27,6 +27,7 @@ init_mteTriggerDeltaTable(void)
+     size_t      mteTDeltaTable_oid_len = OID_LENGTH(mteTDeltaTable_oid);
+     netsnmp_handler_registration    *reg;
+     netsnmp_table_registration_info *table_info;
++    int         rc;
+ 
+     /*
+      * Ensure the (combined) table container is available...
+@@ -61,7 +62,9 @@ init_mteTriggerDeltaTable(void)
+     table_info->max_column = COLUMN_MTETRIGGERDELTADISCONTINUITYIDTYPE;
+ 
+     /* Register this using the (common) trigger_table_data container */
+-    netsnmp_tdata_register(reg, trigger_table_data, table_info);
++    rc = netsnmp_tdata_register(reg, trigger_table_data, table_info);
++    if (rc != SNMPERR_SUCCESS)
++        return;
+     netsnmp_handler_owns_table_info(reg->handler->next);
+     DEBUGMSGTL(("disman:event:init", "Trigger Delta Table\n"));
+ }
+@@ -89,6 +92,9 @@ mteTriggerDeltaTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -97,8 +103,10 @@ mteTriggerDeltaTable_handler(netsnmp_mib_handler *handler,
+              *   rows where the mteTriggerSampleType is 'deltaValue(2)'
+              * So skip entries where this isn't the case.
+              */
+-            if (!entry || !(entry->flags & MTE_TRIGGER_FLAG_DELTA ))
++            if (!entry || !(entry->flags & MTE_TRIGGER_FLAG_DELTA )) {
++                netsnmp_request_set_error(request, SNMP_NOSUCHINSTANCE);
+                 continue;
++            }
+ 
+             switch (tinfo->colnum) {
+             case COLUMN_MTETRIGGERDELTADISCONTINUITYID:
+@@ -125,6 +133,9 @@ mteTriggerDeltaTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -199,6 +210,9 @@ mteTriggerDeltaTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+                 /*
+@@ -219,6 +233,9 @@ mteTriggerDeltaTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/event/mteTriggerExistenceTable.c b/agent/mibgroup/disman/event/mteTriggerExistenceTable.c
+index ce1299f..22b683e 100644
+--- a/agent/mibgroup/disman/event/mteTriggerExistenceTable.c
++++ b/agent/mibgroup/disman/event/mteTriggerExistenceTable.c
+@@ -27,6 +27,7 @@ init_mteTriggerExistenceTable(void)
+     static oid mteTExistTable_oid[]   = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 4 };
+     size_t     mteTExistTable_oid_len = OID_LENGTH(mteTExistTable_oid);
+     netsnmp_handler_registration    *reg;
++    int        rc;
+ 
+     /*
+      * Ensure the (combined) table container is available...
+@@ -61,7 +62,10 @@ init_mteTriggerExistenceTable(void)
+     table_info->max_column = COLUMN_MTETRIGGEREXISTENCEEVENT;
+ 
+     /* Register this using the (common) trigger_table_data container */
+-    netsnmp_tdata_register(reg, trigger_table_data, table_info);
++    rc = netsnmp_tdata_register(reg, trigger_table_data, table_info);
++    if (rc != SNMPERR_SUCCESS)
++        return;
++
+     netsnmp_handler_owns_table_info(reg->handler->next);
+     DEBUGMSGTL(("disman:event:init", "Trigger Exist Table\n"));
+ }
+@@ -89,6 +93,9 @@ mteTriggerExistenceTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -97,8 +104,10 @@ mteTriggerExistenceTable_handler(netsnmp_mib_handler *handler,
+              *   rows where the mteTriggerTest 'existence(0)' bit is set.
+              * So skip entries where this isn't the case.
+              */
+-            if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_EXISTENCE ))
++            if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_EXISTENCE )) {
++                netsnmp_request_set_error(request, SNMP_NOSUCHINSTANCE);
+                 continue;
++            }
+ 
+             switch (tinfo->colnum) {
+             case COLUMN_MTETRIGGEREXISTENCETEST:
+@@ -139,6 +148,9 @@ mteTriggerExistenceTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -212,6 +224,9 @@ mteTriggerExistenceTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+                 /*
+@@ -233,6 +248,9 @@ mteTriggerExistenceTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/event/mteTriggerTable.c b/agent/mibgroup/disman/event/mteTriggerTable.c
+index d738ab5..88c2f8b 100644
+--- a/agent/mibgroup/disman/event/mteTriggerTable.c
++++ b/agent/mibgroup/disman/event/mteTriggerTable.c
+@@ -109,6 +109,9 @@ mteTriggerTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -186,6 +189,9 @@ mteTriggerTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -292,6 +298,9 @@ mteTriggerTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_RESERVE2:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -324,6 +333,9 @@ mteTriggerTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_FREE:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -349,6 +361,9 @@ mteTriggerTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+@@ -373,6 +388,9 @@ mteTriggerTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/event/mteTriggerThresholdTable.c b/agent/mibgroup/disman/event/mteTriggerThresholdTable.c
+index 37d35e0..5aed0c8 100644
+--- a/agent/mibgroup/disman/event/mteTriggerThresholdTable.c
++++ b/agent/mibgroup/disman/event/mteTriggerThresholdTable.c
+@@ -97,6 +97,9 @@ mteTriggerThresholdTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -105,8 +108,10 @@ mteTriggerThresholdTable_handler(netsnmp_mib_handler *handler,
+              *   rows where the mteTriggerTest 'threshold(2)' bit is set.
+              * So skip entries where this isn't the case.
+              */
+-            if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_THRESHOLD ))
++            if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_THRESHOLD )) {
++                netsnmp_request_set_error(request, SNMP_NOSUCHINSTANCE);
+                 continue;
++            }
+ 
+             switch (tinfo->colnum) {
+             case COLUMN_MTETRIGGERTHRESHOLDSTARTUP:
+@@ -189,6 +194,9 @@ mteTriggerThresholdTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+@@ -276,6 +284,9 @@ mteTriggerThresholdTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             if (!entry) {
+                 /*
+@@ -296,6 +307,9 @@ mteTriggerThresholdTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/expr/expErrorTable.c b/agent/mibgroup/disman/expr/expErrorTable.c
+index 6640a41..a759e2d 100644
+--- a/agent/mibgroup/disman/expr/expErrorTable.c
++++ b/agent/mibgroup/disman/expr/expErrorTable.c
+@@ -77,6 +77,9 @@ expErrorTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct expExpression *)
+                     netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+diff --git a/agent/mibgroup/disman/expr/expExpressionTable.c b/agent/mibgroup/disman/expr/expExpressionTable.c
+index ced9e0c..79aa715 100644
+--- a/agent/mibgroup/disman/expr/expExpressionTable.c
++++ b/agent/mibgroup/disman/expr/expExpressionTable.c
+@@ -88,6 +88,9 @@ expExpressionTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct expExpression *)
+                     netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+@@ -150,6 +153,9 @@ expExpressionTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct expExpression *)
+                 netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+@@ -204,6 +210,9 @@ expExpressionTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_RESERVE2:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -236,6 +245,9 @@ expExpressionTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_FREE:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -261,6 +273,9 @@ expExpressionTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+             entry = (struct expExpression *)
+                     netsnmp_tdata_extract_entry(request);
+@@ -286,6 +301,9 @@ expExpressionTable_handler(netsnmp_mib_handler *handler,
+          *  (reasonably) safe to apply them in the Commit phase
+          */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct expExpression *)
+                 netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+diff --git a/agent/mibgroup/disman/expr/expObject.c b/agent/mibgroup/disman/expr/expObject.c
+index 28fbac6..c27437b 100644
+--- a/agent/mibgroup/disman/expr/expObject.c
++++ b/agent/mibgroup/disman/expr/expObject.c
+@@ -240,7 +240,6 @@ void
+ expObject_getData( struct expExpression  *expr, struct expObject  *obj )
+ {
+     netsnmp_variable_list *var;
+-    int res;
+ 
+     /*
+      * Retrieve and store the basic object value(s)
+@@ -279,7 +278,7 @@ expObject_getData( struct expExpression  *expr, struct expObject  *obj )
+                                        expr->expPrefix_len,
+                                        expr->pvars );
+         }
+-        res = netsnmp_query_get( var, expr->session );
++        netsnmp_query_get( var, expr->session );
+     }
+     
+     if ( obj->expObjectSampleType != EXPSAMPLETYPE_ABSOLUTE ) {
+@@ -312,7 +311,7 @@ expObject_getData( struct expExpression  *expr, struct expObject  *obj )
+         else
+             var = _expObject_buildList( obj->expObjDeltaD,
+                                         obj->expObjDeltaD_len, 0, NULL );
+-        res = netsnmp_query_get( var, expr->session );
++        netsnmp_query_get( var, expr->session );
+         if ( obj->old_dvars )
+             snmp_free_varbind( obj->old_dvars );
+         obj->old_dvars = obj->dvars;
+@@ -338,7 +337,7 @@ expObject_getData( struct expExpression  *expr, struct expObject  *obj )
+          *
+          *    (The MIB description seems bogus?)
+          */
+-        res = netsnmp_query_get( var, expr->session );
++        netsnmp_query_get( var, expr->session );
+         if ( obj->cvars )
+             snmp_free_varbind( obj->cvars );
+         obj->cvars = var;
+diff --git a/agent/mibgroup/disman/expr/expObjectTable.c b/agent/mibgroup/disman/expr/expObjectTable.c
+index 4182b3e..adda438 100644
+--- a/agent/mibgroup/disman/expr/expObjectTable.c
++++ b/agent/mibgroup/disman/expr/expObjectTable.c
+@@ -90,6 +90,9 @@ expObjectTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct expObject *)netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+             if (!entry || !(entry->flags & EXP_OBJ_FLAG_VALID))
+@@ -159,6 +162,9 @@ expObjectTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct expObject *)
+                 netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+@@ -211,6 +217,9 @@ expObjectTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_RESERVE2:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -245,6 +254,9 @@ expObjectTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_FREE:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -270,6 +282,9 @@ expObjectTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_ACTION:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+             entry = (struct expObject *)
+                     netsnmp_tdata_extract_entry(request);
+@@ -296,6 +311,9 @@ expObjectTable_handler(netsnmp_mib_handler *handler,
+          */
+         ret = 0;  /* Flag to re-check expExpressionPrefix settings */
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct expObject *) netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info(request);
+ 
+diff --git a/agent/mibgroup/disman/expr/expValueTable.c b/agent/mibgroup/disman/expr/expValueTable.c
+index eac5faa..d74dbd1 100644
+--- a/agent/mibgroup/disman/expr/expValueTable.c
++++ b/agent/mibgroup/disman/expr/expValueTable.c
+@@ -124,7 +124,7 @@ NEXT_EXP:
+         }
+         if ( vp->val.objid[0] != 0 ) {
+             DEBUGMSGTL(( "disman:expr:val",
+-                         "non-zero instance (%d)\n", vp->val.objid[0]));
++                         "non-zero instance (%" NETSNMP_PRIo "d)\n", vp->val.objid[0]));
+             return NULL;  /* Invalid instance */
+         }
+ 
+@@ -158,7 +158,7 @@ NEXT_EXP:
+          */
+         if ( vp->val_len > 0 && vp->val.objid[0] != 0 ) {
+             DEBUGMSGTL(( "disman:expr:val",
+-                         "non-zero next instance (%d)\n", vp->val.objid[0]));
++                         "non-zero next instance (%" NETSNMP_PRIo "d)\n", vp->val.objid[0]));
+             return NULL;        /* All valid instances start with .0 */
+         }
+         plen = exp->expPrefix_len;
+@@ -231,6 +231,8 @@ NEXT_EXP:
+                 len = vp2->name_length - exp->expPrefix_len;
+                 snmp_set_var_typed_value( vp, ASN_PRIV_IMPLIED_OBJECT_ID,
+                       (u_char*)(vp2->name+exp->expPrefix_len), len);
++            } else {
++                len = 1;
+             }
+             res = expValue_evaluateExpression( exp, vp->val.objid+1, len-1);
+             DEBUGMSGTL(( "disman:expr:val", "w/card next returned (%p)\n", res));
+diff --git a/agent/mibgroup/disman/expression/expValueTable.c b/agent/mibgroup/disman/expression/expValueTable.c
+index feace8c..6b315c6 100644
+--- a/agent/mibgroup/disman/expression/expValueTable.c
++++ b/agent/mibgroup/disman/expression/expValueTable.c
+@@ -133,7 +133,7 @@ init_expValueTable(void)
+      * Initialize a "session" that defines who we're going to talk to
+      */
+     snmp_sess_init(&session);   /* set up defaults */
+-    session.peername = "localhost";
++    session.peername = strdup("localhost");
+ 
+     DEBUGMSGTL(("expValueTable", "done.\n"));
+ }
+@@ -272,8 +272,7 @@ Evaluate_Expression(struct expValueTable_data *vtable_data)
+                     break;
+                 }
+             }
+-            strncpy(temp, expression + 1, j - 1);
+-            *(temp + j - 1) = '\0';
++            sprintf(temp, "%.*s", j - 1, expression + 1);
+             l = atoi(temp);
+             expression = expression + j;
+             /*
+@@ -434,24 +433,12 @@ expValueTable_clean(void *data)
+ void
+ build_valuetable(void)
+ {
+-    struct expExpressionTable_data *expstorage, *expfound;
++    struct expExpressionTable_data *expstorage;
+     struct expObjectTable_data *objstorage, *objfound = NULL;
+     struct header_complex_index *hcindex, *object_hcindex;
+     char           *expression;
+-    size_t          expression_len;
+     oid            *index;
+-
+-
+-    char           *result, *resultbak;
+-    char           *temp, *tempbak;
+     int             i = 0, j, l;
+-    temp = malloc(100);
+-    result = malloc(100);
+-    tempbak = temp;
+-    memset(result, 0, 100);
+-    *result = '\0';
+-    resultbak = result;
+-
+ 
+     DEBUGMSGTL(("expValueTable", "building valuetable...  \n"));
+ 
+@@ -460,7 +447,6 @@ build_valuetable(void)
+         expstorage = (struct expExpressionTable_data *) hcindex->data;
+         if (expstorage->expExpressionEntryStatus == RS_ACTIVE) {
+             expression = expstorage->expExpression;
+-            expression_len = expstorage->expExpressionLen;
+             while (*expression != '\0') {
+                 if (*expression == '$') {
+                     i++;
+@@ -475,9 +461,12 @@ build_valuetable(void)
+                             break;
+                         }
+                     }
+-                    strncpy(temp, expression + 1, j - 1);
+-                    *(temp + j - 1) = '\0';
+-                    l = atoi(temp);
++                    {
++                        char temp[100];
++
++                        sprintf(temp, "%.*s", j - 1, expression + 1);
++                        l = atoi(temp);
++                    }
+                     for (object_hcindex = expObjectTableStorage;
+                          object_hcindex != NULL;
+                          object_hcindex = object_hcindex->next) {
+@@ -495,7 +484,6 @@ build_valuetable(void)
+                                 expstorage->expExpressionNameLen)
+                             && (l == objstorage->expObjectIndex)) {
+                             if (objfound == NULL) {
+-                                expfound = expstorage;
+                                 objfound = objstorage;
+                             }
+                             if (objstorage->expObjectIDWildcard ==
+diff --git a/agent/mibgroup/disman/ping/pingCtlTable.c b/agent/mibgroup/disman/ping/pingCtlTable.c
+index a4fd3a8..a5036e2 100644
+--- a/agent/mibgroup/disman/ping/pingCtlTable.c
++++ b/agent/mibgroup/disman/ping/pingCtlTable.c
+@@ -340,12 +340,11 @@ pingProbeHistoryTable_addall(struct pingCtlTable_data *thedata)
+ void
+ pingCtlTable_cleaner(struct header_complex_index *thestuff)
+ {
+-    struct header_complex_index *hciptr = NULL;
+-    struct pingCtlTable_data *StorageDel = NULL;
++    struct header_complex_index *hciptr;
++
+     DEBUGMSGTL(("pingProbeHistoryTable", "cleanerout  "));
+     for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+-        StorageDel =
+-            header_complex_extract_entry(&pingCtlTableStorage, hciptr);
++        header_complex_extract_entry(&pingCtlTableStorage, hciptr);
+         DEBUGMSGTL(("pingProbeHistoryTable", "cleaner  "));
+     }
+ }
+@@ -864,7 +863,6 @@ pingProbeHistoryTable_delLast(struct pingCtlTable_data *thedata)
+ {
+     struct header_complex_index *hciptr2 = NULL;
+     struct header_complex_index *hcilast = NULL;
+-    struct pingProbeHistoryTable_data *StorageDel = NULL;
+     struct pingProbeHistoryTable_data *StorageTmp = NULL;
+     netsnmp_variable_list *vars = NULL;
+     oid             newoid[MAX_OID_LEN];
+@@ -895,9 +893,7 @@ pingProbeHistoryTable_delLast(struct pingCtlTable_data *thedata)
+ 
+         }
+     }
+-    StorageDel =
+-        header_complex_extract_entry(&pingProbeHistoryTableStorage,
+-                                     hcilast);
++    header_complex_extract_entry(&pingProbeHistoryTableStorage, hcilast);
+     DEBUGMSGTL(("pingProbeHistoryTable",
+                 "delete the last one success!\n"));
+ }
+@@ -1231,7 +1227,6 @@ readloop(struct pingCtlTable_data *item, struct addrinfo *ai, int datalen,
+          unsigned long *minrtt, unsigned long *maxrtt,
+          unsigned long *averagertt, pid_t pid)
+ {
+-    int             size;
+     char            recvbuf[BUFSIZE];
+     char            sendbuf[BUFSIZE];
+     int             nsent = 1;
+@@ -1257,8 +1252,6 @@ readloop(struct pingCtlTable_data *item, struct addrinfo *ai, int datalen,
+     }
+     setuid(getuid());           /* don't need special permissions any more */
+ 
+-    size = 60 * 1024;           /* OK if setsockopt fails */
+-
+     tv.tv_sec = 5;
+     tv.tv_usec = 0;
+     setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+@@ -1266,11 +1259,13 @@ readloop(struct pingCtlTable_data *item, struct addrinfo *ai, int datalen,
+     for (current_probe_temp = 1;
+          current_probe_temp <= item->pingCtlProbeCount;
+          current_probe_temp++) {
++        time_t          timep;
+         (*pr->fsend) (datalen, pid, nsent, sockfd, sendbuf);
+         nsent++;
+         len = pr->salen;
+         if (readable_timeo(sockfd, item->pingCtlTimeOut) == 0) {
+             /* printf("socket timeout!\n"); */
++            n = -1;
+             fail_probe = fail_probe + 1;
+             flag = 1;
+         } else {
+@@ -1282,18 +1277,17 @@ readloop(struct pingCtlTable_data *item, struct addrinfo *ai, int datalen,
+ 
+         gettimeofday(&tval, NULL);
+ 
+-        time_t          timep;
+         time(&timep);
+ 
+         (*pr->fproc) (recvbuf, n, &tval, timep, item, ai, datalen, minrtt,
+                       maxrtt, sumrtt, averagertt, current_probe_temp,
+                       success_probe, fail_probe, flag, &current_var, pid);
+-        printf("receiver success!\n");
+         if (current_probe_temp >= item->pingCtlProbeCount) {
+             SNMP_FREE(sumrtt);
+             return;
+         }
+     }
++    close(sockfd);
+ }
+ 
+ unsigned long
+@@ -1599,7 +1593,6 @@ send_v4(int datalen, pid_t pid, int nsent, int sockfd, char *sendbuf)
+ {
+     int             len;
+     struct icmp    *icmp = NULL;
+-    struct timeval *temp = NULL;
+ 
+     icmp = (struct icmp *) sendbuf;
+     icmp->icmp_type = ICMP_ECHO;
+@@ -1607,7 +1600,6 @@ send_v4(int datalen, pid_t pid, int nsent, int sockfd, char *sendbuf)
+     icmp->icmp_id = pid;
+     icmp->icmp_seq = nsent;
+     gettimeofday((struct timeval *) icmp->icmp_data, NULL);
+-    temp = (struct timeval *) icmp->icmp_data;
+ 
+     len = 8 + datalen;          /* checksum ICMP header and data */
+     icmp->icmp_cksum = 0;
+@@ -1773,7 +1765,7 @@ run_ping(unsigned int clientreg, void *clientarg)
+             if (device) {
+                 struct ifreq    ifr;
+                 memset(&ifr, 0, sizeof(ifr));
+-                strncpy(ifr.ifr_name, device, IFNAMSIZ - 1);
++                strlcpy(ifr.ifr_name, device, IFNAMSIZ);
+                 if (setsockopt
+                     (probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device,
+                      strlen(device) + 1) == -1) {
+@@ -1936,6 +1928,7 @@ run_ping(unsigned int clientreg, void *clientarg)
+                   (char *) outpack, &ident, &start_time, &screen_width,
+                   &deadline);
+ 
++        close(icmp_sock);
+     }
+     return;
+ }
+@@ -2705,8 +2698,7 @@ write_pingCtlAdminStatus(int action,
+                     snmp_alarm_register(StorageTmp->pingCtlFrequency,
+                                         SA_REPEAT, run_ping, StorageTmp);
+             else
+-                StorageTmp->timer_id = snmp_alarm_register(1, (int) NULL,
+-                                                           run_ping,
++                StorageTmp->timer_id = snmp_alarm_register(1, 0, run_ping,
+                                                            StorageTmp);
+ 
+         } else if (StorageTmp->pingCtlAdminStatus == 2
+@@ -4367,8 +4359,7 @@ write_pingCtlRowStatus(int action,
+                                             StorageTmp);
+                 else
+                     StorageTmp->timer_id =
+-                        snmp_alarm_register(1, (int) NULL, run_ping,
+-                                            StorageTmp);
++                        snmp_alarm_register(1, 0, run_ping, StorageTmp);
+ 
+             }
+ 
+@@ -4451,7 +4442,9 @@ int
+ __schedule_exit(int next, long *nreceived, long *tmax)
+ {
+     unsigned long   waittime;
++#if 0
+     struct itimerval it;
++#endif
+ 
+     if (*nreceived) {
+         waittime = 2 * (*tmax);
+@@ -4463,11 +4456,13 @@ __schedule_exit(int next, long *nreceived, long *tmax)
+     if (next < 0 || next < waittime / 1000)
+         next = waittime / 1000;
+ 
++#if 0
+     it.it_interval.tv_sec = 0;
+     it.it_interval.tv_usec = 0;
+     it.it_value.tv_sec = waittime / 1000000;
+     it.it_value.tv_usec = waittime % 1000000;
+-    /* setitimer(ITIMER_REAL, &it, NULL); */
++    setitimer(ITIMER_REAL, &it, NULL);
++#endif
+     return next;
+ }
+ 
+@@ -4741,6 +4736,7 @@ setup(int icmp_sock, int options, int uid, int timeout, int preload,
+ 
+     gettimeofday(start_time, NULL);
+ 
++#if 0
+     if (*deadline) {
+         struct itimerval it;
+ 
+@@ -4749,6 +4745,7 @@ setup(int icmp_sock, int options, int uid, int timeout, int preload,
+         it.it_value.tv_sec = (*deadline);
+         it.it_value.tv_usec = 0;
+     }
++#endif
+ 
+     if (isatty(STDOUT_FILENO)) {
+         struct winsize  w;
+diff --git a/agent/mibgroup/disman/ping/pingProbeHistoryTable.c b/agent/mibgroup/disman/ping/pingProbeHistoryTable.c
+index de398a8..78c75be 100644
+--- a/agent/mibgroup/disman/ping/pingProbeHistoryTable.c
++++ b/agent/mibgroup/disman/ping/pingProbeHistoryTable.c
+@@ -74,12 +74,10 @@ void
+ pingProbeHistoryTable_cleaner(struct header_complex_index *thestuff)
+ {
+     struct header_complex_index *hciptr = NULL;
+-    struct pingProbeHistoryTable_data *StorageDel = NULL;
++
+     DEBUGMSGTL(("pingProbeHistoryTable", "cleanerout  "));
+     for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+-        StorageDel =
+-            header_complex_extract_entry(&pingProbeHistoryTableStorage,
+-                                         hciptr);
++        header_complex_extract_entry(&pingProbeHistoryTableStorage, hciptr);
+         DEBUGMSGTL(("pingProbeHistoryTable", "cleaner  "));
+     }
+ 
+diff --git a/agent/mibgroup/disman/ping/pingResultsTable.c b/agent/mibgroup/disman/ping/pingResultsTable.c
+index bc4a9f4..1445d86 100644
+--- a/agent/mibgroup/disman/ping/pingResultsTable.c
++++ b/agent/mibgroup/disman/ping/pingResultsTable.c
+@@ -86,12 +86,11 @@ pingResultsTable_inadd(struct pingResultsTable_data *thedata);
+ void
+ pingResultsTable_cleaner(struct header_complex_index *thestuff)
+ {
+-    struct header_complex_index *hciptr = NULL;
+-    struct pingResultsTable_data *StorageDel = NULL;
++    struct header_complex_index *hciptr;
++
+     DEBUGMSGTL(("pingResultsTable", "cleanerout  "));
+     for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+-        StorageDel =
+-            header_complex_extract_entry(&pingResultsTableStorage, hciptr);
++        header_complex_extract_entry(&pingResultsTableStorage, hciptr);
+         DEBUGMSGTL(("pingResultsTable", "cleaner  "));
+     }
+ 
+diff --git a/agent/mibgroup/disman/schedule/schedCore.h b/agent/mibgroup/disman/schedule/schedCore.h
+index 4436711..35866d7 100644
+--- a/agent/mibgroup/disman/schedule/schedCore.h
++++ b/agent/mibgroup/disman/schedule/schedCore.h
+@@ -44,7 +44,7 @@ struct schedTable_entry {
+     char            schedDay[4+4];
+     char            schedHour[3];
+     char            schedMinute[8];
+-    char            schedContextName[SCHED_STR1_LEN];
++    char            schedContextName[SCHED_STR1_LEN+1];
+     oid             schedVariable[   MAX_OID_LEN   ];
+     size_t          schedVariable_len;
+     long            schedValue;
+diff --git a/agent/mibgroup/disman/schedule/schedTable.c b/agent/mibgroup/disman/schedule/schedTable.c
+index 943e545..bba48fd 100644
+--- a/agent/mibgroup/disman/schedule/schedTable.c
++++ b/agent/mibgroup/disman/schedule/schedTable.c
+@@ -98,6 +98,9 @@ schedTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_GET:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct schedTable_entry *)
+                     netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info( request);
+@@ -210,6 +213,9 @@ schedTable_handler(netsnmp_mib_handler *handler,
+          */
+     case MODE_SET_RESERVE1:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct schedTable_entry *)
+                     netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info( request);
+@@ -340,6 +346,9 @@ schedTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_RESERVE2:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -370,6 +379,9 @@ schedTable_handler(netsnmp_mib_handler *handler,
+ 
+     case MODE_SET_FREE:
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             tinfo = netsnmp_extract_table_info(request);
+ 
+             switch (tinfo->colnum) {
+@@ -417,7 +429,11 @@ schedTable_handler(netsnmp_mib_handler *handler,
+          * All these assignments are "unfailable", so it's
+          *  (reasonably) safe to apply them in the Commit phase
+          */
++        entry = NULL;
+         for (request = requests; request; request = request->next) {
++            if (request->processed)
++                continue;
++
+             entry = (struct schedTable_entry *)
+                     netsnmp_tdata_extract_entry(request);
+             tinfo = netsnmp_extract_table_info( request);
+@@ -460,7 +476,7 @@ schedTable_handler(netsnmp_mib_handler *handler,
+                 recalculate = 1;
+                 break;
+             case COLUMN_SCHEDCONTEXTNAME:
+-                memset(entry->schedContextName, 0, SCHED_STR1_LEN+1);
++                memset(entry->schedContextName, 0, sizeof(entry->schedContextName));
+                 memcpy(entry->schedContextName,
+                                            request->requestvb->val.string,
+                                            request->requestvb->val_len);
+@@ -514,8 +530,10 @@ schedTable_handler(netsnmp_mib_handler *handler,
+                 break;
+             }
+         }
+-        if (recalculate)
++        if (recalculate) {
++            netsnmp_assert(entry);
+             sched_nextTime(entry);
++        }
+         break;
+     }
+     return SNMP_ERR_NOERROR;
+diff --git a/agent/mibgroup/disman/traceroute/traceRouteCtlTable.c b/agent/mibgroup/disman/traceroute/traceRouteCtlTable.c
+index 23ac029..04143eb 100644
+--- a/agent/mibgroup/disman/traceroute/traceRouteCtlTable.c
++++ b/agent/mibgroup/disman/traceroute/traceRouteCtlTable.c
+@@ -713,7 +713,6 @@ traceRouteProbeHistoryTable_delLast(struct traceRouteCtlTable_data
+ {
+     struct header_complex_index *hciptr2 = NULL;
+     struct header_complex_index *hcilast = NULL;
+-    struct traceRouteProbeHistoryTable_data *StorageDel = NULL;
+     struct traceRouteProbeHistoryTable_data *StorageTmp = NULL;
+     netsnmp_variable_list *vars = NULL;
+     oid             newoid[MAX_OID_LEN];
+@@ -745,9 +744,7 @@ traceRouteProbeHistoryTable_delLast(struct traceRouteCtlTable_data
+ 
+         }
+     }
+-    StorageDel =
+-        header_complex_extract_entry(&traceRouteProbeHistoryTableStorage,
+-                                     hcilast);
++    header_complex_extract_entry(&traceRouteProbeHistoryTableStorage, hcilast);
+     DEBUGMSGTL(("traceRouteProbeHistoryTable",
+                 "delete the last one success!\n"));
+     vars = NULL;
+@@ -1353,7 +1350,6 @@ int
+ traceRouteResultsTable_del(struct traceRouteCtlTable_data *thedata)
+ {
+     struct header_complex_index *hciptr2 = NULL;
+-    struct traceRouteResultsTable_data *StorageDel = NULL;
+     netsnmp_variable_list *vars = NULL;
+     oid             newoid[MAX_OID_LEN];
+     size_t          newoid_len = 0;
+@@ -1368,9 +1364,8 @@ traceRouteResultsTable_del(struct traceRouteCtlTable_data *thedata)
+          hciptr2 = hciptr2->next) {
+         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+             == 0) {
+-            StorageDel =
+-                header_complex_extract_entry
+-                (&traceRouteResultsTableStorage, hciptr2);
++            header_complex_extract_entry(&traceRouteResultsTableStorage,
++                                         hciptr2);
+             DEBUGMSGTL(("traceRouteResultsTable", "delete  success!\n"));
+ 
+         }
+@@ -1386,7 +1381,6 @@ int
+ traceRouteProbeHistoryTable_del(struct traceRouteCtlTable_data *thedata)
+ {
+     struct header_complex_index *hciptr2 = NULL;
+-    struct traceRouteProbeHistoryTable_data *StorageDel = NULL;
+     netsnmp_variable_list *vars = NULL;
+     oid             newoid[MAX_OID_LEN];
+     size_t          newoid_len = 0;
+@@ -1402,9 +1396,8 @@ traceRouteProbeHistoryTable_del(struct traceRouteCtlTable_data *thedata)
+          hciptr2 = hciptr2->next) {
+         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+             == 0) {
+-            StorageDel =
+-                header_complex_extract_entry
+-                (&traceRouteProbeHistoryTableStorage, hciptr2);
++            header_complex_extract_entry(&traceRouteProbeHistoryTableStorage,
++                                         hciptr2);
+             DEBUGMSGTL(("traceRouteProbeHistoryTable",
+                         "delete  success!\n"));
+ 
+@@ -1419,7 +1412,6 @@ int
+ traceRouteHopsTable_del(struct traceRouteCtlTable_data *thedata)
+ {
+     struct header_complex_index *hciptr2 = NULL;
+-    struct traceRouteHopsTable_data *StorageDel = NULL;
+     netsnmp_variable_list *vars = NULL;
+     oid             newoid[MAX_OID_LEN];
+     size_t          newoid_len = 0;
+@@ -1435,9 +1427,7 @@ traceRouteHopsTable_del(struct traceRouteCtlTable_data *thedata)
+          hciptr2 = hciptr2->next) {
+         if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+             == 0) {
+-            StorageDel =
+-                header_complex_extract_entry(&traceRouteHopsTableStorage,
+-                                             hciptr2);
++            header_complex_extract_entry(&traceRouteHopsTableStorage, hciptr2);
+             DEBUGMSGTL(("traceRouteHopsTable", "delete  success!\n"));
+ 
+         }
+@@ -3210,8 +3200,7 @@ write_traceRouteCtlAdminStatus(int action,
+                                         SA_REPEAT, run_traceRoute,
+                                         StorageTmp);
+             else
+-                StorageTmp->timer_id = snmp_alarm_register(1, (int) NULL,
+-                                                           run_traceRoute,
++                StorageTmp->timer_id = snmp_alarm_register(1, 0, run_traceRoute,
+                                                            StorageTmp);
+ 
+         } else if (StorageTmp->traceRouteCtlAdminStatus == 2
+@@ -4041,8 +4030,7 @@ write_traceRouteCtlRowStatus(int action,
+                                             StorageTmp);
+                 else
+                     StorageTmp->timer_id =
+-                        snmp_alarm_register(1, (int) NULL, run_traceRoute,
+-                                            StorageTmp);
++                        snmp_alarm_register(1, 0, run_traceRoute, StorageTmp);
+ 
+             }
+ 
+@@ -4924,6 +4912,8 @@ run_traceRoute(unsigned int clientreg, void *clientarg)
+ 
+         }
+ 
++        close(sndsock);
++
+         if (flag == 1) {
+             DEBUGMSGTL(("traceRouteProbeHistoryTable", "path changed!\n"));
+             send_traceRoute_trap(item, traceRoutePathChange,
+@@ -5556,6 +5546,8 @@ run_traceRoute(unsigned int clientreg, void *clientarg)
+ 
+         }
+ 
++        close(sndsock);
++
+         if (flag == 1) {
+             printf("path changed!\n");
+             send_traceRoute_trap(item, traceRoutePathChange,
+@@ -6105,7 +6097,7 @@ ifaddrlist(register struct ifaddrlist **ipaddrp, register char *errbuf)
+ #ifdef HAVE_SOCKADDR_SA_LEN
+     register int    n;
+ #endif
+-    register struct ifreq *ifrp, *ifend, *ifnext, *mp;
++    register struct ifreq *ifrp, *ifend, *ifnext;
+     register struct sockaddr_in *sin;
+     register struct ifaddrlist *al;
+     struct ifconf   ifc;
+@@ -6137,7 +6129,6 @@ ifaddrlist(register struct ifaddrlist **ipaddrp, register char *errbuf)
+     ifend = (struct ifreq *) ((char *) ibuf + ifc.ifc_len);
+ 
+     al = ifaddrlist;
+-    mp = NULL;
+     nipaddr = 0;
+     for (; ifrp < ifend; ifrp = ifnext) {
+ #ifdef HAVE_SOCKADDR_SA_LEN
+@@ -6157,7 +6148,7 @@ ifaddrlist(register struct ifaddrlist **ipaddrp, register char *errbuf)
+          * SIOCGIFFLAGS stomps over it because the requests
+          * are returned in a union.)
+          */
+-        strncpy(ifr.ifr_name, ifrp->ifr_name, sizeof(ifr.ifr_name));
++        strlcpy(ifr.ifr_name, ifrp->ifr_name, sizeof(ifr.ifr_name));
+         if (ioctl(fd, SIOCGIFFLAGS, (char *) &ifr) < 0) {
+             if (errno == ENXIO)
+                 continue;
+@@ -6174,9 +6165,7 @@ ifaddrlist(register struct ifaddrlist **ipaddrp, register char *errbuf)
+         if ((ifr.ifr_flags & IFF_UP) == 0)
+             continue;
+ 
+-
+-        (void) strncpy(device, ifr.ifr_name, sizeof(ifr.ifr_name));
+-        device[sizeof(device) - 1] = '\0';
++        sprintf(device, "%.*s", (int) sizeof(ifr.ifr_name), ifr.ifr_name);
+ #ifdef sun
+         /*
+          * Ignore sun virtual interfaces 
+diff --git a/agent/mibgroup/etherlike-mib/data_access/dot3stats_linux.c b/agent/mibgroup/etherlike-mib/data_access/dot3stats_linux.c
+index efb1b54..00f4bc3 100644
+--- a/agent/mibgroup/etherlike-mib/data_access/dot3stats_linux.c
++++ b/agent/mibgroup/etherlike-mib/data_access/dot3stats_linux.c
+@@ -47,8 +47,8 @@ dot3stats_interface_name_list_get (struct ifname *list_head, int *retval)
+                 *retval = -2;
+                 return NULL;
+             }
+-            memset (list_head, 0, sizeof (struct ifname));
+-            strncpy (list_head->name, p->ifa_name, IF_NAMESIZE);
++            memset(list_head, 0, sizeof (struct ifname));
++            strlcpy(list_head->name, p->ifa_name, IF_NAMESIZE);
+             continue;
+         }
+ 
+@@ -69,8 +69,8 @@ dot3stats_interface_name_list_get (struct ifname *list_head, int *retval)
+             return NULL;
+         }
+         nameptr2 = nameptr2->ifn_next;
+-        memset (nameptr2, 0, sizeof (struct ifname));
+-        strncpy (nameptr2->name, p->ifa_name, IF_NAMESIZE);
++        memset(nameptr2, 0, sizeof (struct ifname));
++        strlcpy(nameptr2->name, p->ifa_name, IF_NAMESIZE);
+         continue;
+ 
+     }
+@@ -655,7 +655,7 @@ interface_ioctl_dot3stats_get (dot3StatsTable_rowreq_ctx *rowreq_ctx, int fd, co
+                 "called\n"));
+ 
+     memset(&ifr, 0, sizeof(ifr));
+-    strcpy(ifr.ifr_name, name);
++    strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+ 
+     memset(&driver_info, 0, sizeof (driver_info));
+     driver_info.cmd = ETHTOOL_GDRVINFO;
+@@ -730,8 +730,8 @@ interface_ioctl_dot3stats_get (dot3StatsTable_rowreq_ctx *rowreq_ctx, int fd, co
+     for (i = 0; i < nstats; i++) {
+         char s[ETH_GSTRING_LEN];
+ 
+-        strncpy(s, (const char *) &eth_strings->data[i * ETH_GSTRING_LEN],
+-            ETH_GSTRING_LEN);
++        strlcpy(s, (const char *) &eth_strings->data[i * ETH_GSTRING_LEN],
++                sizeof(s));
+     
+         if (DOT3STATSALIGNMENTERRORS(s)) {
+             data->dot3StatsAlignmentErrors = (u_long)eth_stats->data[i];
+@@ -911,8 +911,7 @@ _dot3Stats_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name)
+         }
+     }
+ 
+-    strncpy(ifrq->ifr_name, name, sizeof(ifrq->ifr_name));
+-    ifrq->ifr_name[ sizeof(ifrq->ifr_name)-1 ] = 0;
++    strlcpy(ifrq->ifr_name, name, sizeof(ifrq->ifr_name));
+     rc = ioctl(fd, which, ifrq);
+     if (rc < 0) {
+         DEBUGMSGTL(("access:dot3StatsTable:ioctl",
+diff --git a/agent/mibgroup/examples/example.c b/agent/mibgroup/examples/example.c
+index 8f27ead..50b7e7d 100644
+--- a/agent/mibgroup/examples/example.c
++++ b/agent/mibgroup/examples/example.c
+@@ -163,7 +163,7 @@ init_example(void)
+      *  Also set a default value for the string object.  Note that the
+      *   example integer variable was initialised above.
+      */
+-    strncpy(example_str, EXAMPLE_STR_DEFAULT, EXAMPLE_STR_LEN);
++    strlcpy(example_str, EXAMPLE_STR_DEFAULT, sizeof(example_str));
+ 
+     snmpd_register_config_handler("exampleint",
+                                   example_parse_config_exampleint,
+@@ -209,7 +209,7 @@ example_parse_config_examplestr(const char *token, char *cptr)
+     /*
+      * Make sure the string fits in the space allocated for it.
+      */
+-    if (strlen(cptr) < EXAMPLE_STR_LEN)
++    if (strlen(cptr) < sizeof(example_str))
+         strcpy(example_str, cptr);
+     else {
+         /*
+@@ -217,10 +217,8 @@ example_parse_config_examplestr(const char *token, char *cptr)
+          * An alternative approach would be to log an error,
+          *  and discard this value altogether.
+          */
+-        strncpy(example_str, cptr, EXAMPLE_STR_LEN - 4);
+-        example_str[EXAMPLE_STR_LEN - 4] = 0;
+-        strcat(example_str, "...");
+-        example_str[EXAMPLE_STR_LEN - 1] = 0;
++        sprintf(example_str, "%.*s...", (int) (sizeof(example_str) - 4), cptr);
++        netsnmp_assert(strlen(example_str) < sizeof(example_str));
+     }
+ }
+ 
+diff --git a/agent/mibgroup/examples/netSnmpHostsTable_access.c b/agent/mibgroup/examples/netSnmpHostsTable_access.c
+index f6f933a..3d2e5fb 100644
+--- a/agent/mibgroup/examples/netSnmpHostsTable_access.c
++++ b/agent/mibgroup/examples/netSnmpHostsTable_access.c
+@@ -177,10 +177,11 @@ void           *
+ netSnmpHostsTable_create_data_context(netsnmp_variable_list * index_data)
+ {
+     my_data_info *datactx = SNMP_MALLOC_TYPEDEF(my_data_info);
++
+     if (!datactx)
+         return NULL;
+-    strncpy(datactx->hostname, index_data->val.string,
+-            strlen(index_data->val.string));
++    strlcpy(datactx->hostname, (const char *) index_data->val.string,
++            sizeof(datactx->hostname));
+     return datactx;
+ }
+ 
+diff --git a/agent/mibgroup/examples/netSnmpHostsTable_checkfns.c b/agent/mibgroup/examples/netSnmpHostsTable_checkfns.c
+index df47ca4..25a7330 100644
+--- a/agent/mibgroup/examples/netSnmpHostsTable_checkfns.c
++++ b/agent/mibgroup/examples/netSnmpHostsTable_checkfns.c
+@@ -34,9 +34,6 @@ int
+ check_netSnmpHostAddressType(int type, long *val, size_t val_len,
+                              long *old_val, size_t old_val_len)
+ {
+-
+-    int             ret;
+-
+     /** Check to see that we were called legally */
+     if (!val)
+         return SNMP_ERR_GENERR;
+@@ -59,8 +56,6 @@ check_netSnmpHostAddressType(int type, long *val, size_t val_len,
+     default:
+         return SNMP_ERR_INCONSISTENTVALUE;
+     }
+-    ret = SNMP_ERR_NOERROR;
+-
+ 
+     /** looks ok, call the local version of the same function. */
+     return check_netSnmpHostAddressType_local(type, val, val_len, old_val,
+@@ -79,9 +74,6 @@ int
+ check_netSnmpHostAddress(int type, char *val, size_t val_len,
+                          char *old_val, size_t old_val_len)
+ {
+-
+-    int             ret;
+-
+     /** Check to see that we were called legally */
+     if (!val)
+         return SNMP_ERR_GENERR;
+@@ -91,11 +83,8 @@ check_netSnmpHostAddress(int type, char *val, size_t val_len,
+         return SNMP_ERR_WRONGTYPE;
+ 
+     /** Check the ranges of the passed value for legality */
+-    if (!(val_len >= 0 && val_len <= 255)
+-        ) {
++    if (!(val_len >= 0 && val_len <= 255))
+         return SNMP_ERR_WRONGVALUE;
+-    }
+-
+ 
+     /** looks ok, call the local version of the same function. */
+     return check_netSnmpHostAddress_local(type, val, val_len, old_val,
+@@ -138,11 +127,10 @@ check_netSnmpHostStorage(int type, long *val, size_t val_len,
+     default:
+         return SNMP_ERR_INCONSISTENTVALUE;
+     }
+-    ret = SNMP_ERR_NOERROR;
+ 
+-    if (ret =
+-        check_storage_transition((old_val) ? *old_val : SNMP_STORAGE_NONE,
+-                                 *val))
++    ret = check_storage_transition((old_val) ? *old_val : SNMP_STORAGE_NONE,
++                                   *val);
++    if (ret)
+         return ret;
+ 
+     /** looks ok, call the local version of the same function. */
+@@ -187,11 +175,10 @@ check_netSnmpHostRowStatus(int type, long *val, size_t val_len,
+     default:
+         return SNMP_ERR_INCONSISTENTVALUE;
+     }
+-    ret = SNMP_ERR_NOERROR;
+ 
+-    if (ret =
+-        check_rowstatus_transition((old_val) ? *old_val : RS_NONEXISTENT,
+-                                   *val))
++    ret = check_rowstatus_transition((old_val) ? *old_val : RS_NONEXISTENT,
++                                     *val);
++    if (ret)
+         return ret;
+ 
+     /** looks ok, call the local version of the same function. */
+diff --git a/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.h b/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.h
+index 335a0ae..6cd44c9 100644
+--- a/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.h
++++ b/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.h
+@@ -3,8 +3,8 @@
+  *        : : mib2c.check_values_local.conf,v 5.1 2003/05/30 23:53:15 hardaker Exp $
+  * 
+  */
+-#ifndef NETSNMPHOSTSTABLE_CHECKFNS_H
+-#define NETSNMPHOSTSTABLE_CHECKFNS_H
++#ifndef NETSNMPHOSTSTABLE_CHECKFNS_LOCAL_H
++#define NETSNMPHOSTSTABLE_CHECKFNS_LOCAL_H
+ 
+ /*
+  * these functions are designed to check incoming values for 
+@@ -18,19 +18,32 @@
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
++#if 0
++}
++#endif
+ 
+-int             check_(int type, long *val, size_t val_len, long *old_val,
+-                       size_t old_val_len);
+-int             check_(int type, char *val, size_t val_len, char *old_val,
+-                       size_t old_val_len);
+-int             check_(int type, long *val, size_t val_len, long *old_val,
+-                       size_t old_val_len);
+-int             check_(int type, long *val, size_t val_len, long *old_val,
+-                       size_t old_val_len);
+-
++int             check_netSnmpHostAddressType_local(int type, long *val,
++                                                   size_t val_len,
++                                                   long *old_val,
++                                                   size_t old_val_len);
++int             check_netSnmpHostAddress_local(int type, char *val,
++                                               size_t val_len,
++                                               char *old_val,
++                                               size_t old_val_len);
++int             check_netSnmpHostStorage_local(int type, long *val,
++                                               size_t val_len,
++                                               long *old_val,
++                                               size_t old_val_len);
++int             check_netSnmpHostRowStatus_local(int type, long *val,
++                                                 size_t val_len,
++                                                 long *old_val,
++                                                 size_t old_val_len);
+ 
++#if 0
++{
++#endif
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+-#endif                          /* NETSNMPHOSTSTABLE_CHECKFNS_H */
++#endif                          /* NETSNMPHOSTSTABLE_CHECKFNS_LOCAL_H */
+diff --git a/agent/mibgroup/examples/ucdDemoPublic.c b/agent/mibgroup/examples/ucdDemoPublic.c
+index e935216..8e9e66a 100644
+--- a/agent/mibgroup/examples/ucdDemoPublic.c
++++ b/agent/mibgroup/examples/ucdDemoPublic.c
+@@ -25,6 +25,7 @@
+ 
+ #include <net-snmp/net-snmp-includes.h>
+ #include <net-snmp/agent/net-snmp-agent-includes.h>
++#include <net-snmp/library/tools.h>
+ 
+ #include "util_funcs/header_generic.h"
+ #include "ucdDemoPublic.h"
+@@ -213,16 +214,9 @@ write_ucdDemoPublicString(int action,
+         return SNMP_ERR_WRONGLENGTH;
+     }
+     if (action == COMMIT) {
+-        if (var_val_len != 0) {
+-            strncpy((char*)publicString, (const char*)var_val, sizeof(publicString)-1);
+-            /* some sanity checks */
+-            if (strlen((const char*)var_val) > sizeof(publicString)-1 ||
+-                strlen((const char*)var_val) != var_val_len)
+-                publicString[sizeof(publicString)-1] = '\0';
+-            else
+-                publicString[var_val_len] = '\0';
+-        } else
+-            publicString[0] = '\0';
++        sprintf((char*) publicString, "%.*s",
++                (int) SNMP_MIN(sizeof(publicString) - 1, var_val_len),
++                (const char*) var_val);
+     }
+     return SNMP_ERR_NOERROR;
+ }
+diff --git a/agent/mibgroup/hardware/cpu/cpu.c b/agent/mibgroup/hardware/cpu/cpu.c
+index 3a0a5d4..2772001 100644
+--- a/agent/mibgroup/hardware/cpu/cpu.c
++++ b/agent/mibgroup/hardware/cpu/cpu.c
+@@ -142,6 +142,12 @@ netsnmp_cpu_info *netsnmp_cpu_get_byName( char *name, int create ) {
+     cpu = SNMP_MALLOC_TYPEDEF( netsnmp_cpu_info );
+     if (!cpu)
+         return NULL;
++    if (strlen(name) >= sizeof(cpu->name)) {
++        free(cpu);
++        snmp_log(LOG_ERR, "Name of CPU is too large: %s\n", name);
++        return NULL;
++    }
++
+     strcpy(cpu->name, name);
+     if ( _cpu_tail ) {
+         cpu->idx = _cpu_tail->idx+1;
+diff --git a/agent/mibgroup/hardware/cpu/cpu_kerndata.c b/agent/mibgroup/hardware/cpu/cpu_kerndata.c
+index 9a9c4a4..8a7f2b2 100644
+--- a/agent/mibgroup/hardware/cpu/cpu_kerndata.c
++++ b/agent/mibgroup/hardware/cpu/cpu_kerndata.c
+@@ -64,32 +64,32 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+     for ( i=0; i < cpu_num; i++ ) {
+         cpu2 = netsnmp_cpu_get_byIdx( i, 0 );
+ 
+-        cpu2->user_ticks = (unsigned long)vminfo[i].v_time[V_CPU_USER];
+-        cpu2->idle_ticks = (unsigned long)vminfo[i].v_time[V_CPU_IDLE];
+-        cpu2->kern_ticks = (unsigned long)vminfo[i].v_time[V_CPU_KERNEL];
+-        cpu2->wait_ticks = (unsigned long)vminfo[i].v_time[V_CPU_STREAM];
+-        cpu2->sys2_ticks = (unsigned long)vminfo[i].v_time[V_CPU_KERNEL]+
++        cpu2->user_ticks = (unsigned long long)vminfo[i].v_time[V_CPU_USER];
++        cpu2->idle_ticks = (unsigned long long)vminfo[i].v_time[V_CPU_IDLE];
++        cpu2->kern_ticks = (unsigned long long)vminfo[i].v_time[V_CPU_KERNEL];
++        cpu2->wait_ticks = (unsigned long long)vminfo[i].v_time[V_CPU_STREAM];
++        cpu2->sys2_ticks = (unsigned long long)vminfo[i].v_time[V_CPU_KERNEL]+
+                                           vminfo[i].v_time[V_CPU_STREAM];
+             /* nice_ticks, intrpt_ticks, sirq_ticks unused */
+ 
+             /* sum these for the overall stats */
+-        cpu->user_ticks += (unsigned long)vminfo[i].v_time[V_CPU_USER];
+-        cpu->idle_ticks += (unsigned long)vminfo[i].v_time[V_CPU_IDLE];
+-        cpu->kern_ticks += (unsigned long)vminfo[i].v_time[V_CPU_KERNEL];
+-        cpu->wait_ticks += (unsigned long)vminfo[i].v_time[V_CPU_STREAM];
+-        cpu->sys2_ticks += (unsigned long)vminfo[i].v_time[V_CPU_KERNEL]+
++        cpu->user_ticks += (unsigned long long)vminfo[i].v_time[V_CPU_USER];
++        cpu->idle_ticks += (unsigned long long)vminfo[i].v_time[V_CPU_IDLE];
++        cpu->kern_ticks += (unsigned long long)vminfo[i].v_time[V_CPU_KERNEL];
++        cpu->wait_ticks += (unsigned long long)vminfo[i].v_time[V_CPU_STREAM];
++        cpu->sys2_ticks += (unsigned long long)vminfo[i].v_time[V_CPU_KERNEL]+
+                                           vminfo[i].v_time[V_CPU_STREAM];
+ 
+             /*
+              * Interrupt/Context Switch statistics
+              *   XXX - Do these really belong here ?
+              */
+-        cpu->swapIn       += (unsigned long)vminfo[i].v_swpin;
+-        cpu->swapOut      += (unsigned long)vminfo[i].v_swpout;
+-        cpu->pageIn       += (unsigned long)vminfo[i].v_phread;
+-        cpu->pageOut      += (unsigned long)vminfo[i].v_phwrite;
+-        cpu->nInterrupts  += (unsigned long)vminfo[i].v_intr;
+-        cpu->nCtxSwitches += (unsigned long)vminfo[i].v_swtch;
++        cpu->swapIn       += (unsigned long long)vminfo[i].v_swpin;
++        cpu->swapOut      += (unsigned long long)vminfo[i].v_swpout;
++        cpu->pageIn       += (unsigned long long)vminfo[i].v_phread;
++        cpu->pageOut      += (unsigned long long)vminfo[i].v_phwrite;
++        cpu->nInterrupts  += (unsigned long long)vminfo[i].v_intr;
++        cpu->nCtxSwitches += (unsigned long long)vminfo[i].v_swtch;
+     }
+     return 0;
+ }
+diff --git a/agent/mibgroup/hardware/cpu/cpu_kstat.c b/agent/mibgroup/hardware/cpu/cpu_kstat.c
+index 32ccb00..049864c 100644
+--- a/agent/mibgroup/hardware/cpu/cpu_kstat.c
++++ b/agent/mibgroup/hardware/cpu/cpu_kstat.c
+@@ -48,16 +48,13 @@ void init_cpu_kstat( void ) {
+             memset(state, 0, sizeof(state));
+             for (i=0, ks_data = ksp->ks_data; i < ksp->ks_ndata; i++, ks_data++) {
+                 if ( strcmp( ks_data->name, "state" ) == 0 ) {
+-                    strncpy( state, ks_data->value.c, sizeof(state));
+-                    state[sizeof(state)-1] = '\0';
++                    strlcpy(state, ks_data->value.c, sizeof(state));
+                 } else if ( strcmp( ks_data->name, "state_begin" ) == 0 ) {
+                     state_begin = ks_data->value.i32;
+                 } else if ( strcmp( ks_data->name, "cpu_type" ) == 0 ) {
+-                    strncpy( ctype, ks_data->value.c, sizeof(ctype));
+-                    ctype[sizeof(ctype)-1] = '\0';
++                    strlcpy(ctype, ks_data->value.c, sizeof(ctype));
+                 } else if ( strcmp( ks_data->name, "fpu_type" ) == 0 ) {
+-                    strncpy( ftype, ks_data->value.c, sizeof(ftype));
+-                    ftype[sizeof(ftype)-1] = '\0';
++                    strlcpy(ftype, ks_data->value.c, sizeof(ftype));
+                 } else if ( strcmp( ks_data->name, "clock_MHz" ) == 0 ) {
+                     clock = ks_data->value.i32;
+                 }
+@@ -112,30 +109,30 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+                 break;   /* or continue ? */
+             }
+ 
+-            cpu2->user_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_USER];
+-            cpu2->idle_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_IDLE];
+-            cpu2->kern_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_KERNEL];
+-            cpu2->wait_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_WAIT];
++            cpu2->user_ticks = (unsigned long long)cs.cpu_sysinfo.cpu[CPU_USER];
++            cpu2->idle_ticks = (unsigned long long)cs.cpu_sysinfo.cpu[CPU_IDLE];
++            cpu2->kern_ticks = (unsigned long long)cs.cpu_sysinfo.cpu[CPU_KERNEL];
++            cpu2->wait_ticks = (unsigned long long)cs.cpu_sysinfo.cpu[CPU_WAIT];
+               /* or cs.cpu_sysinfo.wait[W_IO]+cs.cpu_sysinfo.wait[W_PIO] */
+-            cpu2->sys2_ticks = (unsigned long)cpu2->kern_ticks+cpu2->wait_ticks;
++            cpu2->sys2_ticks = (unsigned long long)cpu2->kern_ticks+cpu2->wait_ticks;
+                 /* nice_ticks, intrpt_ticks, sirq_ticks unused */
+ 
+                 /* sum these for the overall stats */
+-            cpu->user_ticks += (unsigned long)cs.cpu_sysinfo.cpu[CPU_USER];
+-            cpu->idle_ticks += (unsigned long)cs.cpu_sysinfo.cpu[CPU_IDLE];
+-            cpu->kern_ticks += (unsigned long)cs.cpu_sysinfo.cpu[CPU_KERNEL];
+-            cpu->wait_ticks += (unsigned long)cs.cpu_sysinfo.cpu[CPU_WAIT];
++            cpu->user_ticks += (unsigned long long)cs.cpu_sysinfo.cpu[CPU_USER];
++            cpu->idle_ticks += (unsigned long long)cs.cpu_sysinfo.cpu[CPU_IDLE];
++            cpu->kern_ticks += (unsigned long long)cs.cpu_sysinfo.cpu[CPU_KERNEL];
++            cpu->wait_ticks += (unsigned long long)cs.cpu_sysinfo.cpu[CPU_WAIT];
+               /* or cs.cpu_sysinfo.wait[W_IO]+cs.cpu_sysinfo.wait[W_PIO] */
+-            cpu->sys2_ticks += (unsigned long)cpu2->kern_ticks+cpu2->wait_ticks;
++            cpu->sys2_ticks += (unsigned long long)cpu2->kern_ticks+cpu2->wait_ticks;
+ 
+                 /*
+                  * Interrupt/Context Switch statistics
+                  *   XXX - Do these really belong here ?
+                  */
+-            cpu->swapIn       += (unsigned long)cs.cpu_vminfo.swapin;
+-            cpu->swapOut      += (unsigned long)cs.cpu_vminfo.swapout;
+-            cpu->nInterrupts  += (unsigned long)cs.cpu_sysinfo.intr;
+-            cpu->nCtxSwitches += (unsigned long)cs.cpu_sysinfo.pswitch;
++            cpu->swapIn       += (unsigned long long)cs.cpu_vminfo.swapin;
++            cpu->swapOut      += (unsigned long long)cs.cpu_vminfo.swapout;
++            cpu->nInterrupts  += (unsigned long long)cs.cpu_sysinfo.intr;
++            cpu->nCtxSwitches += (unsigned long long)cs.cpu_sysinfo.pswitch;
+         }
+     }
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +2 -1
index 59d8407..55dd9a6 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.2.5

Part of the diff is not shown here. View the raw message.

#8 lore raw

PATCH 5/7 net-snmp: use netlink support

In reply to Otavio Salvador

To properly compile with netlink we added a patch that ports the netlink use to libnl-3 API.

---
 .../net-snmp/files/libnl-3-support.patch           |   69 ++++++++++++++++++++
 meta-oe/recipes-extended/net-snmp/net-snmp.inc     |    4 +-
 .../recipes-extended/net-snmp/net-snmp_5.7.1.bb    |    3 +-
 3 files changed, 73 insertions(+), 3 deletions(-)
 create mode 100644 meta-oe/recipes-extended/net-snmp/files/libnl-3-support.patch
meta-oe/recipes-extended/net-snmp/files/libnl-3-support.patch new file +69 -0
new file mode 100644
index 0000000..72699b8
@@ -0,0 +1,69 @@
+Add support to libnl-3
+
+Upstream-Status: Pending
+
+--- net-snmp-5.6.1/agent/mibgroup/mibII/tcpTable.c.org	2011-03-27 22:39:13.428728506 +0200
++++ net-snmp-5.6.1/agent/mibgroup/mibII/tcpTable.c	2011-03-27 22:39:47.606956561 +0200
+@@ -555,8 +555,9 @@
+ static int
+ tcpTable_load_netlink(void)
+ {
++	int err;
+ 	/*  TODO: perhaps use permanent nl handle? */
+-	struct nl_handle *nl = nl_handle_alloc();
++	struct nl_sock *nl = nl_socket_alloc();
+ 
+ 	if (nl == NULL) {
+ 		DEBUGMSGTL(("mibII/tcpTable", "Failed to allocate netlink handle\n"));
+@@ -564,10 +565,10 @@
+ 		return -1;
+ 	}
+ 
+-	if (nl_connect(nl, NETLINK_INET_DIAG) < 0) {
+-		DEBUGMSGTL(("mibII/tcpTable", "Failed to connect to netlink: %s\n", nl_geterror()));
+-		snmp_log(LOG_ERR, "snmpd: Couldn't connect to netlink: %s\n", nl_geterror());
+-		nl_handle_destroy(nl);
++	if ((err = nl_connect(nl, NETLINK_INET_DIAG)) < 0) {
++		DEBUGMSGTL(("mibII/tcpTable", "Failed to connect to netlink: %s\n", nl_geterror(err)));
++		snmp_log(LOG_ERR, "snmpd: Couldn't connect to netlink: %s\n", nl_geterror(err));
++		nl_socket_free(nl);
+ 		return -1;
+ 	}
+ 
+@@ -579,10 +580,10 @@
+ 	struct nl_msg *nm = nlmsg_alloc_simple(TCPDIAG_GETSOCK, NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST);
+ 	nlmsg_append(nm, &req, sizeof(struct inet_diag_req), 0);
+ 
+-	if (nl_send_auto_complete(nl, nm) < 0) {
+-		DEBUGMSGTL(("mibII/tcpTable", "nl_send_autocomplete(): %s\n", nl_geterror()));
+-		snmp_log(LOG_ERR, "snmpd: nl_send_autocomplete(): %s\n", nl_geterror());
+-		nl_handle_destroy(nl);
++	if ((err = nl_send_auto_complete(nl, nm)) < 0) {
++		DEBUGMSGTL(("mibII/tcpTable", "nl_send_autocomplete(): %s\n", nl_geterror(err)));
++		snmp_log(LOG_ERR, "snmpd: nl_send_autocomplete(): %s\n", nl_geterror(err));
++		nl_socket_free(nl);
+ 		return -1;
+ 	}
+ 	nlmsg_free(nm);
+@@ -593,9 +594,9 @@
+ 
+ 	while (running) {
+ 		if ((len = nl_recv(nl, &peer, &buf, NULL)) <= 0) {
+-			DEBUGMSGTL(("mibII/tcpTable", "nl_recv(): %s\n", nl_geterror()));
+-			snmp_log(LOG_ERR, "snmpd: nl_recv(): %s\n", nl_geterror());
+-			nl_handle_destroy(nl);
++			DEBUGMSGTL(("mibII/tcpTable", "nl_recv(): %s\n", nl_geterror(len)));
++			snmp_log(LOG_ERR, "snmpd: nl_recv(): %s\n", nl_geterror(len));
++			nl_socket_free(nl);
+ 			return -1;
+ 		}
+ 
+@@ -644,7 +645,7 @@
+ 		free(buf);
+ 	}
+ 
+-	nl_handle_destroy(nl);
++	nl_socket_free(nl);
+ 
+ 	if (tcp_head) {
+ 		DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table using netlink\n"));
meta-oe/recipes-extended/net-snmp/net-snmp.inc +2 -2
index 159c374..c202751 100644
@@ -2,12 +2,12 @@ DESCRIPTION = "Various tools relating to the Simple Network Management Protocol"
 HOMEPAGE = "http://www.net-snmp.org/"
 LICENSE = "BSD"
 
-DEPENDS = "openssl"
+DEPENDS = "openssl libnl"
 RDEPENDS_${PN}-server += "net-snmp-mibs"
 RDEPENDS_${PN}-client += "net-snmp-mibs"
 RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPV}) net-snmp-server (= ${EXTENDPV})"
 RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPV}) net-snmp-server (= ${EXTENDPV})"
-INC_PR = "r0"
+INC_PR = "r1"
 
 inherit autotools update-rc.d siteinfo
 
meta-oe/recipes-extended/net-snmp/net-snmp_5.7.1.bb +2 -1
index 55dd9a6..9cbc5a8 100644
@@ -1,9 +1,10 @@
 require net-snmp.inc
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 LIC_FILES_CHKSUM = "file://README;beginline=3;endline=8;md5=7f7f00ba639ac8e8deb5a622ea24634e"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \
         file://sync-with-5.7-branch.patch \
+        file://libnl-3-support.patch \
         file://init \
         file://snmpd.conf \
         file://snmptrapd.conf"
Signature · 1 line
1.7.2.5
#9 lore raw

PATCH 6/7 net-snmp: move static libs onto ${PN}-staticdev

In reply to Otavio Salvador
---
 meta-oe/recipes-extended/net-snmp/net-snmp.inc |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
meta-oe/recipes-extended/net-snmp/net-snmp.inc +3 -4
index c202751..66dac43 100644
@@ -7,7 +7,7 @@ RDEPENDS_${PN}-server += "net-snmp-mibs"
 RDEPENDS_${PN}-client += "net-snmp-mibs"
 RDEPENDS_${PN}-dev = "net-snmp-client (= ${EXTENDPV}) net-snmp-server (= ${EXTENDPV})"
 RRECOMMENDS_${PN}-dbg = "net-snmp-client (= ${EXTENDPV}) net-snmp-server (= ${EXTENDPV})"
-INC_PR = "r1"
+INC_PR = "r2"
 
 inherit autotools update-rc.d siteinfo
 
@@ -36,11 +36,10 @@ do_install_append() {
 		-i ${STAGING_BINDIR}/net-snmp-config
 }
 
-PACKAGES = "net-snmp-dbg net-snmp-doc net-snmp-dev net-snmp-static net-snmp-libs \
+PACKAGES = "net-snmp-dbg net-snmp-doc net-snmp-dev net-snmp-staticdev net-snmp-static net-snmp-libs \
             net-snmp-mibs net-snmp-server net-snmp-client"
 
-FILES_${PN}-static = "${libdir}/*.a"
-FILES_${PN}-libs = "${libdir}/*"
+FILES_${PN}-libs = "${libdir}/lib*${SOLIBS}"
 FILES_${PN}-mibs = "${datadir}/snmp/mibs"
 FILES_${PN}-server = "${sbindir}/* ${sysconfdir}"
 FILES_${PN}-client = "${bindir}/* ${datadir}/snmp/"
Signature · 1 line
1.7.2.5
#10 lore raw

PATCH 7/7 openbox: add 3.4.11.2

In reply to Otavio Salvador

This version inclues O.S. Systems' internal tree fixes and a sync against 3.4-working branch.

---
 .../openbox/openbox/fix-decorations.patch          |   73 +
 .../openbox/openbox/fix-dialog-buttons.patch       |   38 +
 .../openbox/openbox/sync-with-3.4-working.patch    | 2739 ++++++++++++++++++++
 .../recipes-graphics/openbox/openbox_3.4.11.2.bb   |   40 +
 4 files changed, 2890 insertions(+), 0 deletions(-)
 create mode 100644 meta-oe/recipes-graphics/openbox/openbox/fix-decorations.patch
 create mode 100644 meta-oe/recipes-graphics/openbox/openbox/fix-dialog-buttons.patch
 create mode 100644 meta-oe/recipes-graphics/openbox/openbox/sync-with-3.4-working.patch
 create mode 100644 meta-oe/recipes-graphics/openbox/openbox_3.4.11.2.bb
meta-oe/recipes-graphics/openbox/openbox/fix-decorations.patch new file +73 -0
new file mode 100644
index 0000000..e3489b7
@@ -0,0 +1,73 @@
+Fix client decorations
+
+Upstream-Status: Pending
+
+diff --git a/openbox/client.c b/openbox/client.c
+index c65e350..1c82763 100644
+--- a/openbox/client.c
++++ b/openbox/client.c
+@@ -1733,8 +1733,20 @@ void client_setup_decor_and_functions(ObClient *self, gboolean reconfig)
+     switch (self->type) {
+     case OB_CLIENT_TYPE_NORMAL:
+         /* normal windows retain all of the possible decorations and
+-           functionality, and can be fullscreen */
+-        self->functions |= OB_CLIENT_FUNC_FULLSCREEN;
++           functionality, and can be fullscreen, unless if it can't be resized */
++        if (self->functions & OB_CLIENT_FUNC_RESIZE)
++            self->functions |= OB_CLIENT_FUNC_FULLSCREEN;
++        else {
++            self->decorations &= ~(OB_FRAME_DECOR_HANDLE |
++                                   OB_FRAME_DECOR_MAXIMIZE);
++
++            self->functions &= ~OB_CLIENT_FUNC_MAXIMIZE;
++
++            self->mwmhints.decorations &= ~(OB_MWM_DECOR_HANDLE |
++                                            OB_MWM_DECOR_MAXIMIZE);
++
++            self->mwmhints.functions &= ~OB_MWM_FUNC_MAXIMIZE;
++        }
+         break;
+ 
+     case OB_CLIENT_TYPE_DIALOG:
+diff --git a/openbox/frame.c b/openbox/frame.c
+index 64dd290..fc84f2f 100644
+--- a/openbox/frame.c
++++ b/openbox/frame.c
+@@ -1209,6 +1209,7 @@ static void layout_title(ObFrame *self)
+             firstcon = &self->rightmost;
+         }
+ 
++        self->decorations = self->client->decorations;
+         /* stop at the end of the string (or the label, which calls break) */
+         for (; *lc != '\0' && lc >= config_title_layout; lc+=i) {
+             if (*lc == 'L') {
+@@ -1217,23 +1218,23 @@ static void layout_title(ObFrame *self)
+                     self->label_x = x;
+                 }
+                 break; /* break the for loop, do other side of label */
+-            } else if (*lc == 'N') {
++            } else if (*lc == 'N' && (self->decorations & OB_FRAME_DECOR_ICON)) {
+                 if (firstcon) *firstcon = OB_FRAME_CONTEXT_ICON;
+                 /* icon is bigger than buttons */
+                 place_button(self, lc, bwidth + 2, left, i, &x, &self->icon_on, &self->icon_x);
+-            } else if (*lc == 'D') {
++            } else if (*lc == 'D' && (self->decorations & OB_FRAME_DECOR_ALLDESKTOPS)) {
+                 if (firstcon) *firstcon = OB_FRAME_CONTEXT_ALLDESKTOPS;
+                 place_button(self, lc, bwidth, left, i, &x, &self->desk_on, &self->desk_x);
+-            } else if (*lc == 'S') {
++            } else if (*lc == 'S' && (self->decorations & OB_FRAME_DECOR_SHADE)) {
+                 if (firstcon) *firstcon = OB_FRAME_CONTEXT_SHADE;
+                 place_button(self, lc, bwidth, left, i, &x, &self->shade_on, &self->shade_x);
+-            } else if (*lc == 'I') {
++            } else if (*lc == 'I' && (self->decorations & OB_FRAME_DECOR_ICONIFY)) {
+                 if (firstcon) *firstcon = OB_FRAME_CONTEXT_ICONIFY;
+                 place_button(self, lc, bwidth, left, i, &x, &self->iconify_on, &self->iconify_x);
+-            } else if (*lc == 'M') {
++            } else if (*lc == 'M' && (self->decorations & OB_FRAME_DECOR_MAXIMIZE)) {
+                 if (firstcon) *firstcon = OB_FRAME_CONTEXT_MAXIMIZE;
+                 place_button(self, lc, bwidth, left, i, &x, &self->max_on, &self->max_x);
+-            } else if (*lc == 'C') {
++            } else if (*lc == 'C' && (self->decorations & OB_FRAME_DECOR_CLOSE)) {
+                 if (firstcon) *firstcon = OB_FRAME_CONTEXT_CLOSE;
+                 place_button(self, lc, bwidth, left, i, &x, &self->close_on, &self->close_x);
+             } else
meta-oe/recipes-graphics/openbox/openbox/fix-dialog-buttons.patch new file +38 -0
new file mode 100644
index 0000000..02486ee
@@ -0,0 +1,38 @@
+Fix dialog support
+
+Upstream-Status: Pending
+
+diff --git a/openbox/client.c b/openbox/client.c
+index 4d54b38..c65e350 100644
+--- a/openbox/client.c
++++ b/openbox/client.c
+@@ -562,6 +562,14 @@ void client_manage(Window window, ObPrompt *prompt)
+     /* free the ObAppSettings shallow copy */
+     g_free(settings);
+ 
++    /* force dialogs to skip taskbar */
++    if (self->type == OB_CLIENT_TYPE_DIALOG) {
++        self->skip_taskbar = TRUE;
++
++        gulong state = prop_atoms.net_wm_state_skip_taskbar;
++        PROP_SET32(self->window, net_wm_state, atom, state);
++    }
++
+     ob_debug("Managed window 0x%lx plate 0x%x (%s)\n",
+              window, self->frame->window, self->class);
+ 
+@@ -1733,6 +1741,14 @@ void client_setup_decor_and_functions(ObClient *self, gboolean reconfig)
+         /* sometimes apps make dialog windows fullscreen for some reason (for
+            e.g. kpdf does this..) */
+         self->functions |= OB_CLIENT_FUNC_FULLSCREEN;
++        /* these windows cannot be maximized or minimized*/
++        self->decorations &= ~(OB_FRAME_DECOR_ICONIFY |
++                               OB_FRAME_DECOR_MAXIMIZE |
++                               OB_FRAME_DECOR_HANDLE);
++
++        self->functions &= ~(OB_CLIENT_FUNC_ICONIFY |
++                             OB_CLIENT_FUNC_MAXIMIZE |
++                             OB_CLIENT_FUNC_RESIZE);
+         break;
+ 
+     case OB_CLIENT_TYPE_UTILITY:
meta-oe/recipes-graphics/openbox/openbox/sync-with-3.4-working.patch new file +2739 -0

2,739 lines not on this page · raw message

meta-oe/recipes-graphics/openbox/openbox_3.4.11.2.bb new file +40 -0
new file mode 100644
index 0000000..65349a1
@@ -0,0 +1,40 @@
+DESCRIPTION = "openbox Window Manager"
+SECTION = "x11/wm"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+
+SRC_URI = "http://icculus.org/openbox/releases/openbox-${PV}.tar.gz \
+           file://fix-dialog-buttons.patch;patch=1 \
+           file://fix-decorations.patch;patch=1"
+
+SRC_URI[md5sum] = "30e669134fa81df810fe7d1dc59cd931"
+SRC_URI[sha256sum] = "2e7579389c30e6bb08cc721a2c1af512e049fec2670e71715aa1c4e129ec349d"
+
+inherit autotools gettext update-alternatives
+
+ALTERNATIVE_PATH = "${bindir}/openbox"
+ALTERNATIVE_NAME = "x-window-manager"
+ALTERNATIVE_LINK = "${bindir}/x-window-manager"
+ALTERNATIVE_PRIORITY = "10"
+
+EXTRA_OECONF += "--with-plugins=none"
+
+PACKAGES =+ "${PN}-core ${PN}-lxde ${PN}-gnome"
+
+PACKAGES_DYNAMIC += "${PN}-theme-*"
+
+python populate_packages_prepend() {
+	theme_dir = bb.data.expand('${datadir}/themes/', d)
+	theme_name = bb.data.expand('${PN}-theme-%s', d)
+	do_split_packages(d, theme_dir, '(.*)', theme_name, '${PN} theme for %s', extra_depends='', allow_dirs=True)
+}
+
+RDEPENDS_${PN} += "${PN}-core"
+FILES_${PN}-core = "${bindir}/openbox ${libdir}/*${SOLIBS}"
+
+FILES_${PN}-lxde += "${datadir}/lxde/ \
+                     ${datadir}/lxpanel \
+                     ${datadir}/xsessions \
+                     ${datadir}/icons"
+
+FILES_${PN}-gnome += "${datadir}/gnome/"
Signature · 1 line
1.7.2.5