summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec6233c)
raw | patch | inline | side by side (parent: ec6233c)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 13 Dec 2013 13:29:42 +0000 (14:29 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 13 Dec 2013 13:29:42 +0000 (14:29 +0100) |
src/utils/dbi.c | patch | blob | history |
diff --git a/src/utils/dbi.c b/src/utils/dbi.c
index 26926183e4528a71dd0d495c10377d0c6adbfa67..d9bd3691391ad80a0728a2f9ac88c03033627fa4 100644 (file)
--- a/src/utils/dbi.c
+++ b/src/utils/dbi.c
if ((! client) || (! client->driver) || (! client->database))
return -1;
- if (client->conn)
+ if (client->conn) {
dbi_conn_close(client->conn);
+ client->conn = NULL;
+ }
driver = dbi_driver_open(client->driver);
if (! driver) {
sdb_error_log(SDB_LOG_ERR);
dbi_conn_close(client->conn);
+ client->conn = NULL;
return -1;
}
}
sdb_log(SDB_LOG_ERR, "dbi: failed to set option 'dbname': %s",
sdb_dbi_strerror(client->conn));
dbi_conn_close(client->conn);
+ client->conn = NULL;
return -1;
}
sdb_log(SDB_LOG_ERR, "dbi: failed to connect to database '%s': %s",
client->database, sdb_dbi_strerror(client->conn));
dbi_conn_close(client->conn);
+ client->conn = NULL;
return -1;
}
return 0;
if (client->conn)
dbi_conn_close(client->conn);
+ client->conn = NULL;
if (client->options)
sdb_dbi_options_destroy(client->options);