Package: libvirt / 5.6.0-2

openpty-Skip-test-if-no-pty-is-available.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: =?utf-8?q?Guido_G=C3=BCnther?= <agx@sigxcpu.org>
Date: Thu, 19 Jan 2017 17:16:06 +0100
Subject: openpty: Skip test if no pty is available

In chroots for package builds with recent debootstrap there may be
no ptys or they might not be accessible. This both manifests as ENOENT
on Linux.

Works around #817236
---
 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 267b403..c300938 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;
+          }
         }
     }