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

implicit declaration of function snprintf in openbsd-compat/getdtablecount.c #1249

Closed
NHOrus opened this issue Apr 1, 2024 · 2 comments
Closed

Comments

@NHOrus
Copy link

NHOrus commented Apr 1, 2024

Hello!
opensmtpd fails to build with GCC-14 on Gentoo with error implicit declaration of function snprintf
https://bugs.gentoo.org/922951

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../..  -DIO_TLS -I../../usr.sbin/smtpd -I. -DSMTPD_CONFDIR=\"/etc/smtpd\" -DPATH_CHROOT=\"/var/empty\" -DPATH_SMTPCTL=\"/usr/sbin/smtpctl\" -DPATH_MAILLOCAL=\"/usr/libexec/opensmtpd/mail.local\" -DPATH_MAKEMAP=\"/usr/sbin/makemap\" -DPATH_LIBEXEC=\"/usr/libexec/opensmtpd\" -DHAVE_CONFIG_H -I/usr/lib64 -I/usr/lib64  -I../../openbsd-compat -I../../openbsd-compat/libtls -I../../openbsd-compat/libasr  -isystem /usr/include/bsd -DLIBBSD_OVERLAY -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -std=gnu99 -c -o ../../openbsd-compat/getdtablecount.o ../../openbsd-compat/getdtablecount.c
../../openbsd-compat/getdtablecount.c: In function ‘getdtablecount’:
../../openbsd-compat/getdtablecount.c:35:13: error: implicit declaration of function ‘snprintf’ [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]]
   35 |         if (snprintf(path, sizeof path, "/proc/%ld/fd/*", (long)getpid()) < 0)
      |             ^~~~~~~~
../../openbsd-compat/getdtablecount.c:23:1: note: include ‘<stdio.h>’ or provide a declaration of ‘snprintf’
   22 | #include <unistd.h>
  +++ |+#include <stdio.h>
   23 | 
../../openbsd-compat/getdtablecount.c:35:13: warning: incompatible implicit declaration of built-in function ‘snprintf’ [-Wbuiltin-declaration-mismatch[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wbuiltin-declaration-mismatch]]
   35 |         if (snprintf(path, sizeof path, "/proc/%ld/fd/*", (long)getpid()) < 0)
      |             ^~~~~~~~
../../openbsd-compat/getdtablecount.c:35:13: note: include ‘<stdio.h>’ or provide a declaration of ‘snprintf’

Bug found in opensmtpd-7.4.0 but persists in current master.

@poolpOrg
Copy link
Member

poolpOrg commented Apr 1, 2024

a fix was committed a minute ago if you can test and confirm ?

@NHOrus
Copy link
Author

NHOrus commented Apr 1, 2024

Thank you. Compilation fixed.

@NHOrus NHOrus closed this as completed Apr 1, 2024
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

No branches or pull requests

2 participants