Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 6227] fix build error in gtk/rtp_analysis.c

Date: Tue, 9 Aug 2011 21:04:36 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6227

--- Comment #4 from Bill Meier <wmeier@xxxxxxxxxxx> 2011-08-10 00:04:34 EDT ---
I have committed changes to rtp_analysis.c (SVN #38440) to test the fwrite()
return values to see if a write error occurred and to take action
appropriately.

This fixes rtp_analysis.c.

I should note that there are other Wireshark C source files which do not
currently test the fwrite() return value so maybe your Wireshark build on
Gentoo will report other build errors of a similar nature.
(I will look at testing fwrite() return values in these cases; I suspect here
may be some difficulties).

Obviously, one way to work around these warnings on your system is to use
-Wno-unused-result in CFLAGS (or possibly to use -U_FORTIFY_SOURCE when
building Wireshark).

I'm going to leave this bug open for the moment.

If there are other files which give the same compile warning on your system,
please update this bug (changing the summary to something like "Gentoo
'warn_unused_result' build warnings) and provide the list of files which cause
the warnings. (Thanks)

------------

Unfortunately this issue is a bit complicated with respect to portability

This unused_result warning occurs only on certain Distros because those Distros
configure gcc compilations to warn if the return arg from certain (C Library)
functions is not tested (and to warn about certain other issues).

See [1] for info about the use of this option (-D_FORTIFY_SOURCE)
[1]http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html

Also: It seems that distros may customize the list of functions which are
configured to give the warning (with -D_FORTIFY_SOURCE).

E.G. For Ubuntu: It appears that -D_FORTIFY_SOURCE=2 is the default and also
'Starting with Jaunty, fwrite was removed from the list of functions that are
marked with "warn_unused_result".)' [2]
[2]https://wiki.ubuntu.com/CompilerFlags

For Fedora15 (and presumably earlier) -D_FORTIFY_SOURCE is *not* the default
and fwrite *is* included in the list (warned if -D_FORTIFY_SOURCE=2 is
explicitly specified in CFLAGS).

Based upon your report it appears that the stable Gentoo you mention presumably
uses -D_FORTIFY_SOURCE=2 as the default and includes fwrite() in the list of
functions so warned.

--------------

For a  Wireshark-dev list discussion on this see the (long) message thread
starting at
http://www.wireshark.org/lists/wireshark-dev/201106/msg00088.html

Also see the thread starting at:
http://www.wireshark.org/lists/wireshark-dev/201106/msg00087.html

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.