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.kinnu...@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

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#49895): https://lists.yoctoproject.org/g/yocto/message/49895
Mute This Topic: https://lists.yoctoproject.org/mt/75351043/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to