Wireshark-dev: Re: [Wireshark-dev] Compilation failure - privileges.c: In function 'relinquish_
From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Sat, 29 Sep 2012 16:05:00 -0400
On 8/21/2012 2:19 AM, Guy Harris wrote:

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).


I've started getting this warning also (F17...) (maybe just now since today is the first time I've done a 'make clean' etc in a while).

So:

1. There's a long thread (which started Jul 24,2012) about
"[PATCH] Declare set*id with warn_unused_result"

at

http://old.nabble.com/-PATCH--Declare-set*id-with-warn_unused_result-td34204904.html

2. Doing a (void)... as suggested by Guy above doesn't prevent the error. Using a hack like 'if(!setresgid() {}' does work but seems ugly;

returning a success/failure indication to the callers of relinquish_special_privs_perm() seems like too much work.

My inclination: test the return value of the various set*id calls and if fail, do g_error().

Thoughts ?

Bill