On Thu, Oct 10, 2013 at 05:00:14PM +0200, Jakub Hrozek wrote:
On Thu, Oct 10, 2013 at 12:09:17PM +0200, Lukas Slebodnik wrote:
> ehlo,
>
> scan-build found a warning.
>
> src/providers/krb5/krb5_child.c:1988:9: error: ‘offline’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> ret = k5c_setup(kr, offline);
>
> gcc also reports this warning with enabled optimization >= "-O2".
>
> It seems to me really weird, because compilator assumes that function
> sss_atomic_read_s return value -1 and errno==0.
> I tried to modify function sss_atomic_read_s, but I could not fix this warning.
>
> Another possible solution is to initialize variable "offline" to some
default
> value.
>
> I appreciate any comment.
>
> Patch is attached.
>
> LS
I think this is fine, the fix would protect us from a potential bug in
sss_atomic_write. Maybe even a better fix would be to modify
sss_atomic_write to return errno as a return value and the number of
bytes only on success?
But ticket #2112 is a different issue, we should remove the reference to
it from the commit message.
The patch fixes a compilation warning so ACK and pushed to master.