Skip to content

b64_ntop and b64_pton #47

@cyberia-ng

Description

@cyberia-ng

On Chimera Linux, the build fails with

signify.c:144:6: error: call to undeclared function 'b64_pton'; ISO C99 and
      later do not support implicit function declarations [-Wimplicit-function-declaration]
  144 |         if (b64_pton(commentend + 1, buf, buflen) != buflen)
      |             ^
signify.c:231:6: error: call to undeclared function 'b64_ntop'; ISO C99 and
      later do not support implicit function declarations [-Wimplicit-function-declaration]
  231 |         if (b64_ntop(buf, buflen, b64, sizeof(b64)) == -1)
      |             ^
signify.c:624:12: error: call to undeclared function 'b64_pton'; ISO C99 and
      later do not support implicit function declarations [-Wimplicit-function-declaration]
  624 |         if ((rv = b64_pton(hash, data, sizeof(data))) == -1)
      |                   ^

I see that somebody else had the same issue in #43, which seems stale. The proposed solution of adding the headers to compat.h works, but I got curious as to why it was working on a glibc system with the same compiler. It turns out that glibc's resolv.h has the same lineage as OpenBSD's and exports the relevant headers by chance, while musl's resolv.h does not. (Why it is that the base64 function headers are in resolv.h in the first place is a mystery to me.)

So that's why the build works on glibc systems even with -Wimplicit-function-declaration. Adding the headers to compat.h fixes this. I'll write a PR with the relevant changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions