1
0
mirror of https://github.com/agdsn/ancient-weatherstation.git synced 2026-06-19 23:07:59 +00:00

Deemon: Fix handling of broken Database Connection

fixes #14


git-svn-id: file:///home/jan/tmp/wetterstation/trunk@259 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
jan
2008-07-29 14:54:14 +00:00
parent b65de8de92
commit 23ff8045db
4 changed files with 19 additions and 7 deletions
+4 -1
View File
@@ -77,7 +77,10 @@ int main(int argc, char *argv[]){
#endif
DEBUGOUT1("Programm gestartet\n");
if(signal(SIGPIPE, SIG_IGN) == SIG_ERR)
exit_error(ERROR_SEIINST);
DEBUGOUT1("SIGPIPE ignoriert\n");
if(signal(SIGABRT, exit_sig_handler) == SIG_ERR)
exit_error(ERROR_SEIINST);
DEBUGOUT1("Signalhandler zum beenden per SIGABRT installiert\n");
+3
View File
@@ -113,6 +113,9 @@ static void check_create_query_buffer(){
/* Guckt ob Verbindung da und versucht aufzubauen.
* gibt 1 zurueck, wenn erfolgreich, sonst 0 */
static int pg_connect(){
if (PQstatus(connection) == CONNECTION_OK){
PQexec(connection,"SELECT 1"); /* Status neusetzen erzwingen */
}
if(PQstatus(connection) != CONNECTION_OK){
if (connection == NULL){
if(conn_string == NULL){