Re: [Nagios-db-devel] Segfaults with the postgres ned - SUCCESS !
Status: Beta
Brought to you by:
bench23
From: Tim V. <dj...@ro...> - 2005-01-24 15:41:50
|
On Thu, 20 Jan 2005, Ben wrote: > Okay, well, there's a new postgres inserter.c checked into cvs. I now > check the query result to see if it succeeded, and if not, log it. I'm not > at all clear why PQclear() would be crashing, but perhaps the added > logging will show something. > > I also started compiling with -Wall, which caught some printf sloppiness, > but that shouldn't have done anything bad. Hi Ben, Since I've been playing with a copy of the inserter code to test my things and because of your new inserter code in CVS, I've went to try your code again so all my changes were out. And the first problem I've run into getting inserter going again was the querify function again. Somehow it always fails to add ' and the null char at the end. So I focused a bit on debugging this. Well the fix was pretty simple and the big benefit was that all of a sudden everything started working. No more segfaults. Attached is a diff to the CVS version with changes. The fix is to give PQescapeString the length of the from string and not the to string. A second change I made is to add 3 instead of 2 to the length of the to string. This since we are adding 2 ' characters and you already have to do +1 according to the pgsql docs. All the rest of the changes are just some costmetic changes to the log messages. I find it cleaner this way. Feel free to discard them :-) One more thing is the pgsql connection parameters. These are at the moment hardcoded. I've seen in the nagios docs that you can also give parameters to NEB modules. It this something on your todo ? Or else I'm interrested to have a look at that. Now I start testing the UI :-) Regards, Tim -- Tim Verhoeven - dj...@ro... - 0479 / 88 11 83 /* This is total bullshit: */ linux-2.6.6/drivers/video/sis/init301.c |