On Sat, Jun 05, 2010 at 12:17:39AM +0200, Andreas Mock wrote:

> Hi all,
> 
> after debugging a problem for hours I found out at the end
> that ha_logger has a problem with long messages on the
> command line.
> 
> * how to get the problem:
> ha_logger -t test "veryveryverylongmessage"  with length of 
> "veryveryverylongmessage" is more than 1024 bytes.
> 
> Output is then an usage message and an exit code of 1.
> This causes problems in the way ha_logger is used in 
> ha_log.sh. (Other story)
> 
> Attached you find a patch for ha_logger.c.
> This patch is the result of a dry coding session. I don't have
> the build environment. Therefore it would be great if someone
> could try to compile and build it and do some tests.
> 
> Please don't hesitate to ask if problems arise.

Your patch seems to change a lot of whitespace as well,
which makes it not obvious what exactly the functional change is.

But thanks for pointing out the place where things could go wrong.
I think the original intention was more like

diff -r c447fc25e119 logd/ha_logger.c
--- a/logd/ha_logger.c  Fri Apr 23 19:32:43 2010 +0200
+++ b/logd/ha_logger.c  Mon Jun 07 15:30:55 2010 +0200
@@ -105,12 +105,11 @@
                        if (p + len > endp && p > buf) {
                                if (LogToDaemon(priority,buf,
                                                strnlen(buf, 1024),FALSE) 
==HA_OK){
+                                       p = buf;
                                        continue;
                                }else{
                                        return EXIT_FAIL;
                                }
-                               /* NOTREACHED */
-                               /* p = buf; */
                        }
                        if (len > sizeof(buf) - 1) {
                                if (LogToDaemon(priority,*argv,



and the "NOTREACHED" comment added two and a half years later
was correct, but failed to see and fix the bug instead.

Not tested either, but if that on-line patch works,
this would be the change I'd go for.

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to