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:
@@ -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");
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user