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

Bug #280989 reported by Matthew on 2008-10-09
2
Affects Status Importance Assigned to Milestone
mylvmbackup
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);
}

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
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  Edit
Everyone can see this information.

Other bug subscribers