All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Anibal Limon" <anibal.limon@linaro.org>
To: Tero Kinnunen <tero.kinnunen@vaisala.com>
Cc: Yocto discussion list <yocto@yoctoproject.org>
Subject: Re: [ptest-runner][PATCH] Fix inappropriate ioctl when detaching tty
Date: Tue, 7 Jul 2020 08:49:11 -0500	[thread overview]
Message-ID: <CA+_Aqit9G99McMscX24hr5OqS0-WCcOWP5H2f6iqbQ=OvKM2Pg@mail.gmail.com> (raw)
In-Reply-To: <20200707072140.152639-1-tero.kinnunen@vaisala.com>

[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]

Hi Tero,

First thanks for the patch, Is there an option to test for isatty(fd) for
run ioctl instead?.

Regards,
Anibal

On Tue, 7 Jul 2020 at 02:21, Tero Kinnunen <tero.kinnunen@vaisala.com>
wrote:

> Fixes error
>
>     ERROR: Unable to detach from controlling tty, Inappropriate ioctl for
> device
>
> when running multiple ptests
>
>     ptest-runner a b
>
> or when invoked over ssh single command, like
>
>     $ ssh localhost ptest-runner a
>
> For ssh case, fd 0 is not a tty. (isatty(0) is false).
> When running multiple ptests, deattach for parent needs to be
> done only once. On subsequent calls, if deattach fails,
> according to man 4 tty
>
>     it is obviously not attached to a terminal and does not
>     need to detach itself.
>
> Detach was not necessary, skip the error message.
>
> Signed-off-by: Tero Kinnunen <tero.kinnunen@vaisala.com>
> ---
>  utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/utils.c b/utils.c
> index a8ba190..35ef551 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -444,7 +444,7 @@ run_ptests(struct ptest_list *head, const struct
> ptest_options opts,
>                                 break;
>                         }
>                         dirname(ptest_dir);
> -                       if (ioctl(0, TIOCNOTTY) == -1) {
> +                       if (ioctl(0, TIOCNOTTY) == -1 && errno != ENOTTY) {
>                                 fprintf(fp, "ERROR: Unable to detach from
> controlling tty, %s\n", strerror(errno));
>                         }
>
> --
> 2.25.1
>
>

[-- Attachment #2: Type: text/html, Size: 2237 bytes --]

  reply	other threads:[~2020-07-07 13:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  7:21 [ptest-runner][PATCH] Fix inappropriate ioctl when detaching tty Tero Kinnunen
2020-07-07 13:49 ` Anibal Limon [this message]
2020-07-08  6:46   ` Tero Kinnunen
2020-07-09 14:21     ` [yocto] " Anibal Limon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+_Aqit9G99McMscX24hr5OqS0-WCcOWP5H2f6iqbQ=OvKM2Pg@mail.gmail.com' \
    --to=anibal.limon@linaro.org \
    --cc=tero.kinnunen@vaisala.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.