[pacman-dev] Warnings with -D_FORTIFY_SOURCE=2

Xavier Chantry chantry.xavier at gmail.com
Mon Jun 14 06:16:53 EDT 2010


On Mon, Jun 14, 2010 at 11:35 AM, Allan McRae <allan at archlinux.org> wrote:
> Hi,
>
> Trying to build pacman with the gcc flag -D_FORTIFY_SOURCE=2 gives a bunch
> of warnings like:
>
> add.c:586:8: warning: ignoring return value of ‘chdir’, declared with
> attribute warn_unused_result
> be_files.c:660:9: warning: ignoring return value of ‘fgets’, declared with
> attribute warn_unused_result
> util.c:146:9: warning: ignoring return value of ‘fwrite’, declared with
> attribute warn_unused_result
> pacman.c:712:8: warning: ignoring return value of ‘getcwd’, declared with
> attribute warn_unused_result
> util.c:796:12: warning: ignoring return value of ‘asprintf’, declared with
> attribute warn_unused_result
>
> There are 21 warnings in total.  Would there be in interest in adding the
> return value check (some of which would be basically useless...) and adding
> -D_FORTIFY_SOURCE=2 to the CFLAGS when used with --enable-debug?
>

If it's easy to check (because the function already does some error
handling, or it is easy to add), then go for it.


More information about the pacman-dev mailing list