[Home]

Summary:ASTERISK-10447: [patch] loge reason why DB can't be open
Reporter:Dmitry Andrianov (dimas)Labels:
Date Opened:2007-10-04 15:56:35Date Closed:2007-10-05 14:28:06
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) dblog.patch
( 1) dblog-2.patch
Description:when Asterisk can't open /var/lib/asterisk/astdb it logs "Unable to open Asterisk database\n" without any information which file it tries to open exactly and without the error.

proper error description is half of problem solution :) when you see

[Oct  5 05:01:50] WARNING[19068] db.c: Unable to open Asterisk database /var/lib/asterisk/astdb: Permission denied

You quickly realize you forgot to change owner on /var/lib/asterisk :)

patch adds filename+strerror
Comments:By: Jason Parker (jparker) 2007-10-04 16:12:38

I think we should we check if errno is set.  If astdb is null, it won't even try to dbopen, so errno won't be set.

By: Dmitry Andrianov (dimas) 2007-10-04 17:06:42

well, as I understand the code, if astdb is null it is the only case when it will ever try opening the file.
If astdb is non-null, because of && sharthand operator, dbopen won't get called and function returns zero without logging eny errors. Non-null astdb means it is already open.

If you prefer, I rewritten the same code to be more line-consuming :) but also more clear (on my opinion) - see dblog-2.patch

By: Digium Subversion (svnbot) 2007-10-05 14:22:50

Repository: asterisk
Revision: 84851

U   branches/1.4/main/db.c

------------------------------------------------------------------------
r84851 | tilghman | 2007-10-05 14:22:49 -0500 (Fri, 05 Oct 2007) | 2 lines

Log exactly why we can't open the database, if we fail (closes issue ASTERISK-10447)

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-10-05 14:28:06

Repository: asterisk
Revision: 84852

_U  trunk/
U   trunk/main/db.c

------------------------------------------------------------------------
r84852 | tilghman | 2007-10-05 14:28:04 -0500 (Fri, 05 Oct 2007) | 10 lines

Merged revisions 84851 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r84851 | tilghman | 2007-10-05 14:42:21 -0500 (Fri, 05 Oct 2007) | 2 lines

Log exactly why we can't open the database, if we fail (closes issue ASTERISK-10447)

........

------------------------------------------------------------------------