-
Notifications
You must be signed in to change notification settings - Fork 280
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
constants: increase SCTP_DIAG_INFO_LEN to accommodate longer file paths #521
Conversation
I'm using |
This happens on debian sid (Linux) with gcc (Debian 10.1.0-6) 10.1.0. Warnings are:
|
I guess it is time to disable the warning... It doesn't make sense, since I want to output to be truncated if it is too long... |
Is there a reason to keep the message buffer length so small though? I mean, why not enlarge it? Performance concerns or? |
The buffer is (often) allocated on the stack and the sources are shared with the FreeBSD kernel stack. At least in the kernel, the space on the stack is limited. I'm fine with the string being truncated, that is why I'm using snprintf(). gcc seems not to like this, don't know why. At some point of time, it was OK to check the return code to avoid this warning. However, in the FreeBSD kernel, snprintf() never fails. So I introduced a macro to deal with this. But newer gcc versions seem not to support the usage of snprintf() with truncation intended... |
Ah, I see. Thanks for the explanation. One could allow a larger buffer |
We could change it for the userland stack... Can you use something like
|
.. but only for the userspace stack. Can happen when used as a meson subproject, for example. Fixes "‘%s’ directive output truncated writing XX bytes into a region of size NN [-Wformat-truncation=]" compiler warnings with gcc10 on Linux.
91c55fd
to
46c8221
Compare
Thanks for the patch. |
Can happen when used as a meson subproject, for example.
Fixes "‘%s’ directive output truncated writing XX bytes into
a region of size NN [-Wformat-truncation=]" compiler warnings.