]> xenbits.xensource.com Git - unikraft/libs/newlib.git/commitdiff
Revisit pty.c functions
authorCostin Lupu <costin.lupu@cs.pub.ro>
Mon, 2 Sep 2019 13:31:03 +0000 (16:31 +0300)
committerCostin Lupu <costin.lupu@cs.pub.ro>
Tue, 3 Sep 2019 17:25:07 +0000 (20:25 +0300)
Actually the openpty() and forkpty() stubs should return errors, because
otherwise the callee will try to use the amaster and aslave file descriptors
returned by the functions.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
pty.c

diff --git a/pty.c b/pty.c
index 009688d2327f4918cbe006ede6fb10d7d383352b..07346de9958f4762f98219819b9dfa64143856fc 100644 (file)
--- a/pty.c
+++ b/pty.c
  * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
  */
 
-#include <pty.h>
-#include <sys/types.h>
 #include <uk/essentials.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <pty.h>
 
 int openpty(int *amaster __unused, int *aslave __unused, char *name __unused,
                const struct termios *termp __unused,
                const struct winsize *winp __unused)
 {
-       return 0;
+       errno = ENOENT;
+       return -1;
 }
 
 pid_t forkpty(int *amaster __unused, char *name __unused,
                const struct termios *termp __unused,
                const struct winsize *winp __unused)
 {
-       return 0;
+       errno = ENOENT;
+       return -1;
 }