Hello PostgreSQL developers,
9.0beta5 seems to enable -Werror by default (which is a good thing,
thanks!). FORTIFY_SOURCE catches a few places where the result of
write() and fgets() is not checked, and thus the build fails with
gcc -g -O2 -g -Wall -O2 -fPIC -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-fno-strict-aliasing-fwrapv -g -Werror -I../../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2
-I/usr/include/tcl8.5 -c -o elog.o elog.c
cc1: warnings being treated as errors
elog.c: In function 'write_console':
elog.c:1698: error: ignoring return value of 'write', declared with attribute warn_unused_result
elog.c: In function 'write_pipe_chunks':
elog.c:2390: error: ignoring return value of 'write', declared with attribute warn_unused_result
elog.c:2399: error: ignoring return value of 'write', declared with attribute warn_unused_result
make[4]: *** [elog.o] Error 1
[...]
gcc -g -O2 -g -Wall -O2 -fPIC -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-fno-strict-aliasing-fwrapv -g -Werror -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic
-DFRONTEND-DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.5
-I../../../src/port-I../../../src/port -DSO_MAJOR_VERSION=5 -c -o fe-auth.o fe-auth.c
gcc -g -O2 -g -Wall -O2 -fPIC -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-fno-strict-aliasing-fwrapv -g -Werror -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -fpic
-DFRONTEND-DUNSAFE_STAT_OK -I. -I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.5
-I../../../src/port-I../../../src/port -DSO_MAJOR_VERSION=5 -c -o fe-connect.o fe-connect.c
cc1: warnings being treated as errors
fe-connect.c: In function ‘PasswordFromFile’:
fe-connect.c:4403: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
etc.
I attach a patch (against git head) to check the results of those. For
src/bin/psql/common.c this is really just an "ignore the result", but
in src/bin/psql/prompt.c it actually fixes a potential crash.
Thank you for considering!
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)