]> git.puffer.fish Git - matthieu/frr.git/commit
lib: fix backtraces broken by 837d16c...
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 19 Nov 2013 14:00:06 +0000 (15:00 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 21 Mar 2014 05:28:48 +0000 (06:28 +0100)
commit4d474fa3297c0d5d632e2c0bff6ccb0edbedaa5d
tree61ca2f19e552df821eb2dc06cd9e06c81993aacf
parentc78a46c27f6dfdd42fe0800cebabc1e49cb0a4bf
lib: fix backtraces broken by 837d16c...

837d16c ("*: use array_size() helper macro") accidentally changed one of
the expressions in the backtrace code, which afterwards read:

zlog_backtrace_sigsafe():
  if (((size = backtrace(array,array_size(array)) <= 0) ||

which boils down to: (size = backtrace(...)  <= 0).  The braces were
intended to go:      (size = backtrace(...)) <= 0.

All in all, this makes a nice textbook example of the original author
being too clever (trying to save a single line by pulling the assignment
into the condition) and the next person touching the code tripping over
it...

This code occurs another time in zlog_backtrace() where it is actually
correct.  Pulling out the assignment nonetheless.  Also, new test
program.

Cc: Andrew J. Schorr <ajschorr@alumni.princeton.edu>
Cc: Balaji.G <balajig81@gmail.com>
Cc: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/log.c
tests/.gitignore
tests/Makefile.am
tests/test-segv.c [new file with mode: 0644]