[SSSD] [PATCH] MONITOR: Fix warning may be used uninitialized

Jakub Hrozek jhrozek at redhat.com
Thu Oct 23 17:09:15 UTC 2014


On Thu, Oct 23, 2014 at 07:02:56PM +0200, Lukas Slebodnik wrote:
> On (23/10/14 18:38), Jakub Hrozek wrote:
> >On Thu, Oct 23, 2014 at 06:35:07PM +0200, Jakub Hrozek wrote:
> >> On Thu, Oct 23, 2014 at 02:14:03PM +0200, Michal Židek wrote:
> >> > On 10/23/2014 11:36 AM, Lukas Slebodnik wrote:
> >> > >ehlo,
> >> > >
> >> > >src/monitor/monitor.c: In function ‘main’:
> >> > >src/monitor/monitor.c:2953:24: error: ‘monitor’ may be used uninitialized
> >> > >                                in this function [-Werror=maybe-uninitialized]
> >> > >      monitor->is_daemon = !opt_interactive;
> >> > >                         ^
> >> > >cc1: all warnings being treated as errors
> >> > >
> >> > >This warning is caused be change 579e5d4b7a3ca161ea7518b2996905fa22c15995
> >> > >"MONITOR: Allow confdb to be accessed by nonroot user"
> >> > >
> >> > >Patch is attached.
> >> > >
> >> > >LS
> >> > >
> >> 
> >> Not sure I understand, under what circumstances can errno be 0 while
> >> chown returns 0?
> >
> >Err, while chown returns -1
> Try to explain it gcc with optimization (-O2), but usually gcc does not lie.

I know, but this code just makes wonder what's going on even now, I'm
pretty sure I will have no idea a year from now...

> 
> another way how to suppress warning is to initialize variabl monitor to NULL

That sounds like a more readable option to me.



More information about the sssd-devel mailing list