snar / bgpq3

bgpq3
BSD 2-Clause "Simplified" License
363 stars 53 forks source link

Linux doesn't support strlcpy #12

Closed yeled closed 9 years ago

yeled commented 9 years ago

as reported by @job this is broken since adding https://github.com/snar/bgpq3/commit/d787382df03378695075dc86b9cee51d83fdfc31 - in particular strlcpy, which is a Theoism. Should libbsd be included for linux distributions or the more risky strncpy?

4:18 netmon1-r10-sfo2:~/bgpq3% make
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -c bgpq3.c
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -c sx_report.c
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -c bgpq_expander.c
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -c sx_slentry.c
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -c bgpq3_printer.c
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -c sx_prefix.c
sx_prefix.c: In function ‘sx_prefix_parse’:
sx_prefix.c:56:2: warning: implicit declaration of function ‘strlcpy’ [-Wimplicit-function-declaration]
  strlcpy(mtext, text, sizeof(mtext));
  ^
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -c strlcpy.c
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -c sx_maxsockbuf.c
gcc -std=gnu99 -DHAVE_CONFIG_H -g -Wall -I. -O0 -o bgpq3 bgpq3.o sx_report.o bgpq_expander.o sx_slentry.o bgpq3_printer.o sx_prefix.o strlcpy.o sx_maxsockbuf.o -lnsl
4:18 netmon1-r10-sfo2:~/bgpq3%
snar commented 9 years ago

strlcpy is already included in bgpq3, missing declaration added to sx_prefix.h. Thanks for reporting.