|
All, I had been struggling with the snprint_value() function for
some time. It appeared to fail when attempting to return results from a
string value. The revised code has resolved that issue for me. BTB,
the problem would only manifect itself in *nix. Windows was always
Aok. The string that is passed to the function is a char array within a
structure within an array that was allocated using the “calloc”
function. Net-snmp did not want anything to do with that. Regards, Larry Adams The Cacti Group int snprint_value(char *obuf, size_t buf_len, const oid *
objid, size_t objidlen, struct variable_list * variable) { u_char
*buf = NULL; size_t
out_len = 0; int
ret_val = 0; if
(buf = (u_char *) calloc(buf_len, 1)) { if
(sprint_realloc_value(&buf, &buf_len, &out_len, 1, objid,
objidlen, variable)) { snprintf(obuf,
buf_len, "%s", buf); }else{ snprintf(obuf,
buf_len, "%s [TRUNCATED]", buf); } ret_val
= out_len; }else{ snprintf(obuf,
buf_len, "”); ret_val
= -1; } free(buf);
} |
