Pārlūkot izejas kodu

permissions: convert module to use DB_TABLE_VERSION_ERROR helper

- convert module to use DB_TABLE_VERSION_ERROR helper
- unify error handling (properly close database on errors, null db handle)
Henning Westerholt 6 gadi atpakaļ
vecāks
revīzija
db7841aa78

+ 2 - 1
src/modules/permissions/address.c

@@ -311,8 +311,9 @@ int init_addresses(void)
 	}
 
 	if(db_check_table_version(&perm_dbf, db_handle, &address_table, TABLE_VERSION) < 0) {
-		LM_ERR("error during table version check.\n");
+		DB_TABLE_VERSION_ERROR(address_table);
 		perm_dbf.close(db_handle);
+		db_handle = 0;
 		return -1;
 	}
 

+ 3 - 2
src/modules/permissions/trusted.c

@@ -203,8 +203,9 @@ int init_trusted(void)
 		}
 
 		if(db_check_table_version(&perm_dbf, db_handle, &trusted_table, TABLE_VERSION) < 0) {
-			LM_ERR("error during table version check.\n");
+			DB_TABLE_VERSION_ERROR(trusted_table);
 			perm_dbf.close(db_handle);
+			db_handle = 0;
 			return -1;
 		}
 
@@ -272,7 +273,7 @@ int init_child_trusted(int rank)
 
 	if (db_check_table_version(&perm_dbf, db_handle, &trusted_table,
 				TABLE_VERSION) < 0) {
-		LM_ERR("error during table version check.\n");
+		DB_TABLE_VERSION_ERROR(trusted_table);
 		perm_dbf.close(db_handle);
 		return -1;
 	}