| [Date Prev] [Date Next] | [Thread Prev] [Thread Next] | [Date Index] [Thread Index] |
[snips-users] Fix for no subdevices being logged "+device" and not "/var+device"
|
On Thu, Feb 26, 2004 at 08:38:00AM -0700, Anthony Veale wrote:
> > Did anybody ever fix the subdevice not being passed out by snipslogd bug?
>
> I don't think anyone has. I haven't delved too deeply into this one,
> but I have the general impression that subdevices were added in late
> in the game. A number of issues surrounding them were not completely
> implemented.
>
> It also appears that this particular issue might exist in the
> underlying C code.
Right.
I've just had a C programmer look at this buglet for me, and he seems to
have corrected it.
The problem was in event_utils.c. The fix isn't the most elegant but it
works, we suspect a bracketing problem or wrong number of fields in the
original code as the problem.
I had to recompile everything that uses event_utils.c, namely
display_snips_datafile and snipslogd obviously.
Here's a diff.
1c1
< /* $Header: /home/cvsroot/snips/lib/event_utils.c,v 1.2 2002/01/30 05:40:17 vikas Exp $ */
---
> /* $Header: /cvsroot/snips/lib/event_utils.c,v 1.2 2002/01/30 05:40:17 vikas Exp $ */
100,116c100,106
< if (*(v->device.subdev)) {
< sprintf(fmts + strlen(fmts),
< "DEVICE %s%s%s %s VAR %s %ld %ld %s LEVEL %s LOGLEVEL %s STATE %s\n",
< v->device.subdev, "+",
< v->device.name, v->device.addr,
< v->var.name, v->var.value, v->var.threshold, v->var.units,
< severity_txt[v->severity], severity_txt[v->loglevel],
< states) ;
< } else {
< sprintf(fmts + strlen(fmts),
< "DEVICE %s%s%s %s VAR %s %ld %ld %s LEVEL %s LOGLEVEL %s STATE %s\n",
< "", "",
< v->device.name, v->device.addr,
< v->var.name, v->var.value, v->var.threshold, v->var.units,
< severity_txt[v->severity], severity_txt[v->loglevel],
< states) ;
< }
---
> sprintf(fmts + strlen(fmts),
> "DEVICE %s%s%s %s VAR %s %ld %ld %s LEVEL %s LOGLEVEL %s STATE %s\n",
> (*(v->device.subdev))? v->device.subdev, "+" : "", "",
> v->device.name, v->device.addr,
> v->var.name, v->var.value, v->var.threshold, v->var.units,
> severity_txt[v->severity], severity_txt[v->loglevel],
> states) ;
--
Robert Lister - London Internet Exchange - http://www.linx.net/
robl at linx net - tel: +44 (0)20 7645 3510 - RL786-RIPE
|