Wireshark mailing list archives

Re: Compilation failure - privileges.c: In function 'relinquish_special_privs_perm' - ignoring return value of 'setresgid', declared with attribute warn_unused_result [-Werror=unused-result]


From: Guy Harris <guy () alum mit edu>
Date: Mon, 20 Aug 2012 23:19:26 -0700


On Aug 20, 2012, at 12:49 PM, Kaul wrote:

If it were git, I'm sure I could easily use 'git bisect' and find the issue.

As Evan Huus indicated, what you probably need to bisect is compiler updates. :-)

The offending routine is probably relinquish_special_privs_perm() (which has failed to check the return value of 
setresuid() and setresgid() since at least 2007), and, if those calls were to fail, it's not clear what Wireshark 
should do, so it's not clear that relinquish_special_privs_perm() should return a success/failure indication, and it's 
not clear that there's anything to do if any of the set.*id routines return anything other than 0, so perhaps the right 
fix is to cast the return values to void, so as to tell the compiler "yes, I'm deliberately ignoring the return value, 
because there's not much to do if they fail". 

I suppose we *could* have relinquish_special_privs_perm() return a success/failure indication, and have its *callers* 
cheerfully ignore the return value, or print a warning message/pop up a warning dialog if they fail (if they fail, then 
we were started with special privileges, but those privileges weren't sufficient to relinquish them, in which case the 
developers should be notified so we can figure out whether there's any way to relinquish them in that situation).
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: