On (16/02/15 21:15), Roland Mainz wrote: > > >----- Original Message ----- >> From: "Jakub Hrozek" <jhro...@redhat.com> >> To: sssd-devel@lists.fedorahosted.org >> Sent: Friday, February 13, 2015 5:31:40 PM >> Subject: Re: [SSSD] [PATCH] SELINUX: Check the return value of setuid and >> setgid >> >> On Thu, Feb 12, 2015 at 04:56:54AM -0500, Roland Mainz wrote: >> > >> > >> > ----- Original Message ----- >> > > From: "Jakub Hrozek" <jhro...@redhat.com> >> > > To: sssd-devel@lists.fedorahosted.org >> > > Sent: Tuesday, January 27, 2015 8:35:20 PM >> > > Subject: [SSSD] [PATCH] SELINUX: Check the return value of setuid and >> > > setgid >> > > >> > > Hi, >> > > >> > > As the automated test tools of our downstream discovered, selinux_child >> > > now compiles with a warning if -Wunused-result is set: >> > > >> > > sssd-1.12.2/src/providers/ipa/selinux_child.c:227:15: warning: ignoring >> > > return value of 'setgid', declared with attribute warn_unused_result >> > > [-Wunused-result] >> > > sssd-1.12.2/src/providers/ipa/selinux_child.c:223:15: warning: ignoring >> > > return value of 'setuid', declared with attribute warn_unused_result >> > > [-Wunused-result] >> > > >> > > Sorry I didn't catch this earlier, but I don't think we can do much about >> > > the error anyway, just warn. >> > >> > Does the warning go away if you cast the result to |(void)|, e.g. >> > |(void)setuid(666)| ? Classical UNIX programming coding style (basically >> > enforced by lint(1) defaults) is that each unused function return value >> > must be casted to |(void)|. >> >> That would work, too, but I think logging the failure is more user >> friendly. > >OK... > >... slightly offtopic: Do you know any gcc warning option which can emulate >lint(1)'s warning for unused/unconsumed return values ?
The answer is: yes it has [-Wunused-result] src/providers/ipa/selinux_child.c: In function 'main': src/providers/ipa/selinux_child.c:223:15: warning: ignoring return value of 'setuid', declared with attribute warn_unused_result [-Wunused-result] setuid(0); ^ src/providers/ipa/selinux_child.c:227:15: warning: ignoring return value of 'setgid', declared with attribute warn_unused_result [-Wunused-result] setgid(0); ^ LS _______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/sssd-devel