Skip to content

Use correct 'LDNS_STATUS_NULL' rather than 'false' in dnssec.c - #310

Open
liweitianux wants to merge 1 commit into
NLnetLabs:developfrom
liweitianux:fix-dnssec-return-value
Open

liweitianux wants to merge 1 commit into
NLnetLabs:developfrom
liweitianux:fix-dnssec-return-value

Conversation

@liweitianux

Copy link
Copy Markdown
Contributor

ldns_nsec_bitmap_set_type() and ldns_nsec_bitmap_clear_type() would return false (i.e., LDNS_STATUS_OK) when the input bitmap is NULL.

Following the existing convention, correct it to be LDNS_STATUS_NULL.

ldns_nsec_bitmap_set_type() and ldns_nsec_bitmap_clear_type() would
return 'false' (i.e., LDNS_STATUS_OK) when the input bitmap is NULL.

Following the existing convention, correct it to be LDNS_STATUS_NULL.
@liweitianux

Copy link
Copy Markdown
Contributor Author

However, I'm not very sure whether this is the correct/expected fix, i.e., return an error instead of OK for a bitmap=NULL.

I noticed this code mismatch when I was compiling the code in an environment where the true and false are defined as an enumeration, i.e.,

enum { false = 0, true = 1 };

As a result, the compiler generated the following warnings:

.../lib/ldns/dnssec.c: In function ‘ldns_nsec_bitmap_set_type’:
.../lib/ldns/dnssec.c:1444:24: error: implicit conversion from ‘enum <anonymous>’ to ‘ldns_status’ {aka ‘enum ldns_enum_status’} [-Werror=enum-conversion]
 1444 |                 return false;
      |                        ^~~~~
.../lib/ldns/dnssec.c: In function ‘ldns_nsec_bitmap_clear_type’:
.../lib/ldns/dnssec.c:1482:24: error: implicit conversion from ‘enum <anonymous>’ to ‘ldns_status’ {aka ‘enum ldns_enum_status’} [-Werror=enum-conversion]
 1482 |                 return false;
      |                        ^~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant