test: fix test/test-tty.c for AIX
'/dev/random' causes 'isatty()' to return 1 on AIX[1]. This causes an issue where 'dev/tty' is opened (hard coded in src/unix/tty.c:uv_tty_init). Tried to replace the hardcoded value with what is returned by 'ttyname()' but on AIX all that is returned is '/dev/'. This seems to be a bug with the AIX kernel. [1]http://goo.gl/wGa7mf PR-URL: https://github.com/libuv/libuv/pull/624 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
parent
7b9bc28e85
commit
f5796d2fba
@ -153,11 +153,14 @@ TEST_IMPL(tty_file) {
|
|||||||
ASSERT(0 == close(fd));
|
ASSERT(0 == close(fd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Bug on AIX where '/dev/random' returns 1 from isatty() */
|
||||||
|
#ifndef _AIX
|
||||||
fd = open("/dev/random", O_RDONLY);
|
fd = open("/dev/random", O_RDONLY);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
ASSERT(UV_EINVAL == uv_tty_init(&loop, &tty, fd, 1));
|
ASSERT(UV_EINVAL == uv_tty_init(&loop, &tty, fd, 1));
|
||||||
ASSERT(0 == close(fd));
|
ASSERT(0 == close(fd));
|
||||||
}
|
}
|
||||||
|
#endif /* _AIX */
|
||||||
|
|
||||||
fd = open("/dev/zero", O_RDONLY);
|
fd = open("/dev/zero", O_RDONLY);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user