[systemd-devel] [PATCH 3/3] util : Remove dead code

Thomas H.P. Andersen phomes at gmail.com
Tue Sep 16 14:36:37 PDT 2014


On Tue, Sep 16, 2014 at 11:27 PM,  <philippedeswert at gmail.com> wrote:
> From: Philippe De Swert <philippedeswert at gmail.com>
>
> We only break out of the pre-ceding loop into the rest of the code
> if fd is actually >= 0. So the < 0 check will never be true and
> not necessary.
>
> Found with Coverity. Fixes: CID#1237577

I pushed a fix for this one 20 minutes ago. (I also set the CID as
assigned to me but maybe we need a better way to coordinate?)

> ---
>  src/shared/util.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/src/shared/util.c b/src/shared/util.c
> index 61d6680..30b0364 100644
> --- a/src/shared/util.c
> +++ b/src/shared/util.c
> @@ -1878,9 +1878,6 @@ int open_terminal(const char *name, int mode) {
>                  c++;
>          }
>
> -        if (fd < 0)
> -                return -errno;
> -
>          r = isatty(fd);
>          if (r < 0) {
>                  safe_close(fd);
> --
> 1.8.3.2
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list