script doesn't die on dbh->connect() failure

Bug #280989 reported by Matthew
2
Affects Status Importance Assigned to Milestone
mylvmbackup
Fix Released
Medium
Lenz Grimmer

Bug Description

Consider this code from mylvmbackup.pl:192

my $dbh= DBI->connect($dsn,$user,$password)
  or log_msg ($DBI::errstr, LOG_ERR) && die $DBI::errstr;

On DBI->connect() failure, the log_msg() runs, but the die() does not. Code execution continues on to the next line which is run_hook("preflush");

Proposed fix. Verified correct behavior.

my $dbh = DBI->connect($dsn,$user,$password);
if(!$dbh)
{
        log_msg ($DBI::errstr, LOG_ERR);
        die($DBI::errstr);
}

Revision history for this message
Lenz Grimmer (lenzgr) wrote :

Thanks for the suggestion - a fix for this was commited into the trunk some time ago, it will be part of the next release.

Changed in mylvmbackup:
assignee: nobody → lenzgr
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
Lenz Grimmer (lenzgr) wrote :

This bug was fixed in release 0.11.

Changed in mylvmbackup:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.