[systemd-devel] [PATCH] ask-password-api.c: fix assigned but not read warning

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Jun 26 05:04:14 PDT 2014


On Thu, Jun 26, 2014 at 01:49:56PM +0200, Daniel Buch wrote:
> Well we assign fd to be -1 above signalfd() and afterwards never read it.
> That's what my compiler complained about.
> 
> Thinking further i guess its the assignment thats redundant since cleanup
> attribute calls safe_close() that basiclly assigns fd to be -1.
No, it's not redundant. If it wasn't assigned to -1, it would be closed on the
exit from function, resultin in a double close, the first time when f is
destroyed.

> I got, gcc version 4.9.0 20140604 (prerelease) (GCC)
You might want to report this as a regression then, I don't think we had
this warning before.

Zbyszek


More information about the systemd-devel mailing list