[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
openpty: Skip test if no pty is available
From: |
Guido Günther |
Subject: |
openpty: Skip test if no pty is available |
Date: |
Thu, 19 Jan 2017 19:14:54 +0100 |
User-agent: |
NeoMutt/20161126 (1.7.1) |
In chroots for package builds there may be no ptys or they might not be
accessible. This both manifests as ENOENT on Linux. Skip tests in this
case.
---
gnulib/tests/test-openpty.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/gnulib/tests/test-openpty.c b/gnulib/tests/test-openpty.c
index 2858d50..603c5f2 100644
--- a/gnulib/tests/test-openpty.c
+++ b/gnulib/tests/test-openpty.c
@@ -25,6 +25,7 @@
SIGNATURE_CHECK (openpty, int, (int *, int *, char *, struct termios const *,
struct winsize const *));
+#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
@@ -43,8 +44,12 @@ main ()
int res = openpty (&master, &slave, NULL, NULL, NULL);
if (res != 0)
{
- fprintf (stderr, "openpty returned %d\n", res);
- return 1;
+ if (errno != ENOENT) {
+ fprintf (stderr, "openpty returned %d: %s\n", res,
strerror(errno));
+ return 1;
+ } else {
+ return 77;
+ }
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- openpty: Skip test if no pty is available,
Guido Günther <=