Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sprintf of size_t #405

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Fix sprintf of size_t #405

merged 1 commit into from
Feb 23, 2024

Conversation

df7cb
Copy link
Contributor

@df7cb df7cb commented Feb 23, 2024

This failed on 32-bit platforms.

/home/myon/projects/postgresql/pgagroal/pgagroal/src/libpgagroal/prometheus.c: In function ‘send_chunk’:
/home/myon/projects/postgresql/pgagroal/pgagroal/src/libpgagroal/prometheus.c:2104:18: error: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=]
 2104 |    sprintf(m, "%lX\r\n", strlen(data));
      |                ~~^       ~~~~~~~~~~~~
      |                  |       |
      |                  |       size_t {aka unsigned int}
      |                  long unsigned int
      |                %X

This failed on 32-bit platforms.
@jesperpedersen jesperpedersen added the bug Something isn't working label Feb 23, 2024
@jesperpedersen jesperpedersen merged commit a9c4c13 into agroal:master Feb 23, 2024
2 checks passed
@jesperpedersen
Copy link
Collaborator

Merged.

Thanks for your contribution !

@jesperpedersen
Copy link
Collaborator

BTW, do you need a release for this ? Or, can we look at feedback for a bit ?

@df7cb
Copy link
Contributor Author

df7cb commented Feb 23, 2024

I patched it locally for Debian first to see if it actually works, so no release needed. Thanks!

@df7cb df7cb deleted the sprintf-size_t branch February 23, 2024 20:26
@jesperpedersen
Copy link
Collaborator

Great 👍 Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants