Code

postgresql plugin: Fixed unregistering of write callbacks.
authorSebastian Harl <sh@tokkee.org>
Thu, 15 Nov 2012 09:04:46 +0000 (10:04 +0100)
committerSebastian Harl <sh@tokkee.org>
Thu, 15 Nov 2012 09:06:45 +0000 (10:06 +0100)
Rather than unregistering some callback for each writer for each database,
unregister the single callback for each database only.

src/postgresql.c

index 4d2436056fd76cac09f2b6a92a2304125ddab715..ef7a5ec1ddd58fd9f1a22a38b23cc55121048e2b 100644 (file)
@@ -942,11 +942,9 @@ static int c_psql_shutdown (void)
 
        for (i = 0; i < databases_num; ++i) {
                c_psql_database_t *db = databases + i;
-               size_t j = 0;
 
-               for (j = 0; j < db->writers_num; ++j) {
+               if (db->writers_num > 0) {
                        char cb_name[DATA_MAX_NAME_LEN];
-
                        ssnprintf (cb_name, sizeof (cb_name), "postgresql-%s",
                                        db->database);
                        plugin_unregister_write (cb_name);