The implementation used to capture output from the NetSNMP library calls for inclusion in the TCL result string has the side-effect of destroying any redirections of stdout and stderr applied to the process using the extension. The code assumes that calling freopen() on /dev/tty for stdout and stderr is sufficient; but this isn't the case if either or both output streams have been redirected prior to calls into the extension code.
The attached patch to tcl-snmptools-1.0/generic/util.c corrects this behavior for platforms that have dup(), dup2(), and fcntl(). I don't know what the equivalent fix on e.g. WIN32 looks like.
Log in to post a comment.