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

Daniel Buch boogiewasthere at gmail.com
Thu Jun 26 04:49:56 PDT 2014


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.


I got, gcc version 4.9.0 20140604 (prerelease) (GCC)


2014-06-26 13:12 GMT+02:00 Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>:

> On Thu, Jun 26, 2014 at 12:50:40PM +0200, Daniel Buch wrote:
> > Not sure this is an appropiate fix, feel free to leave it out
> >
> > ---
> >  src/shared/ask-password-api.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/shared/ask-password-api.c
> b/src/shared/ask-password-api.c
> > index 5997a03..39eab0d 100644
> > --- a/src/shared/ask-password-api.c
> > +++ b/src/shared/ask-password-api.c
> > @@ -344,7 +344,7 @@ int ask_password_agent(
> >
> >          fd = -1;
> >
> > -        signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
> > +        signal_fd = signalfd(fd, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
> >          if (signal_fd < 0) {
> >                  log_error("signalfd(): %m");
> >                  r = -errno;
> The compiler should not warn here, since fd has a cleanup function defined,
> which obviously looks at fd. What compiler and version is that?
>
> Zbyszek
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140626/3bf12384/attachment.html>


More information about the systemd-devel mailing list