Sfoglia il codice sorgente

fix errno for posix_openpt with no free ptys available

linux fails the open with ENOSPC, but POSIX mandates EAGAIN.
Rich Felker 5 anni fa
parent
commit
4fd0f20560
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      src/misc/pty.c

+ 3 - 1
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)