master - tests: don't crash if checked string is shorter
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=739b751046c17ba8e6225821446951e6742c16eb Commit: 739b751046c17ba8e6225821446951e6742c16eb Parent: b1002e98e020e0a9e35bcf75eac5a991550fc0b2 Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Feb 12 10:39:37 2015 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Thu Feb 12 15:38:51 2015 +0100
tests: don't crash if checked string is shorter
Not really sure what is this testing - just avoid coredump if the test cannot happen since the index would too high.
--- test/lib/brick-shelltest.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
test/lib/brick-shelltest.h +1 -1
@@ -958,7 +958,7 @@ struct Main { flav != options.flavours.end(); ++flav ) { for ( Listing::iterator i = l.begin(); i != l.end(); ++i ) { -if ( i->substr ( i->length () -3 , i->length () ) !=".sh" ) +if ( ( i->length () <3 ) || ( i->substr ( i->length () -3 , i->length () ) !=".sh" ) )continue ;if ( i->substr (0 ,4 ) =="lib/" )continue ;