Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
char country_code[3];
int r = loc_network_new(ctx, network, address, prefix);
char country_code[3];
int r = loc_network_new(ctx, network, address, prefix);
+ if (r) {
+ ERROR(ctx, "Could not allocate a new network: %s", strerror(-r));
// Import country code
loc_country_code_copy(country_code, dbobj->country_code);
r = loc_network_set_country_code(*network, country_code);
// Import country code
loc_country_code_copy(country_code, dbobj->country_code);
r = loc_network_set_country_code(*network, country_code);
+ if (r) {
+ ERROR(ctx, "Could not set country code: %s\n", country_code);
- r = loc_network_set_asn(*network, be32toh(dbobj->asn));
- if (r)
+ uint32_t asn = be32toh(dbobj->asn);
+ r = loc_network_set_asn(*network, asn);
+ if (r) {
+ ERROR(ctx, "Could not set ASN: %d\n", asn);
- r = loc_network_set_flag(*network, be16toh(dbobj->flags));
- if (r)
+ int flags = be16toh(dbobj->flags);
+ r = loc_network_set_flag(*network, flags);
+ if (r) {
+ ERROR(ctx, "Could not set flags: %d\n", flags);