about summary refs log tree commit diff
path: root/src/misc
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2019-10-22 10:22:22 -0400
committerRich Felker <dalias@aerifal.cx>2019-10-24 10:25:09 -0400
commit4fd0f2056082441a4503f6bfcb787a7c15754518 (patch)
treeddfa487e29dcda5dbbc0bb5f47c2cf1616831cea /src/misc
parent9b2921bea1d5017832e1b45d1fd64220047a9802 (diff)
downloadmusl-4fd0f2056082441a4503f6bfcb787a7c15754518.tar.gz
musl-4fd0f2056082441a4503f6bfcb787a7c15754518.tar.xz
musl-4fd0f2056082441a4503f6bfcb787a7c15754518.zip
fix errno for posix_openpt with no free ptys available
linux fails the open with ENOSPC, but POSIX mandates EAGAIN.
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/pty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/misc/pty.c b/src/misc/pty.c
index b9cb5eaa..a0577147 100644
--- a/src/misc/pty.c
+++ b/src/misc/pty.c
@@ -7,7 +7,9 @@
 
 int posix_openpt(int flags)
 {
-	return open("/dev/ptmx", flags);
+	int r = open("/dev/ptmx", flags);
+	if (r < 0 && errno == ENOSPC) errno = EAGAIN;
+	return r;
 }
 
 int grantpt(int fd)