[mylvmbackup] Re: script doesn't die on db connect failure
- From: Lenz Grimmer <lenz@xxxxxxxxxxx>
- To: mylvmbackup@xxxxxxxxxxxxx
- Date: Wed, 22 Oct 2008 21:46:55 +0200
Hi Matthew,
sorry for the late reply, I've been on vacation for the past two weeks and am
on a trade show the entire week, which does not leave me much time to catch up
with my email backlog...
On 10/10/2008 12:10 AM, Boehm, Matthew wrote:
> Just noticed this. If I turn off MySQL and attempt to run the script,
> the "preflush" script will actually run.
>
> 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.
Odd, I guess I never actually tested that ;)
> 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);
> }
Excellent, thanks for the patch! Applied and pushed into trunk.
Bye,
LenZ
--
------------------------------------------------------------------
Lenz Grimmer <lenz@xxxxxxxxxxx> -o)
[ICQ: 160767607 | Jabber: LenZGr@xxxxxxxxxx] /\\
http://www.lenzg.org/ V_V
- References:
- [mylvmbackup] script doesn't die on db connect failure
- From: Boehm, Matthew
Other related posts:
- » [mylvmbackup] script doesn't die on db connect failure
- » [mylvmbackup] Re: script doesn't die on db connect failure
- [mylvmbackup] script doesn't die on db connect failure
- From: Boehm, Matthew