diff options
Diffstat (limited to 'src/util/pty/getpty.c')
-rw-r--r-- | src/util/pty/getpty.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/util/pty/getpty.c b/src/util/pty/getpty.c index 3683ba6..0e86514 100644 --- a/src/util/pty/getpty.c +++ b/src/util/pty/getpty.c @@ -24,15 +24,17 @@ #include "libpty.h" #include "pty-int.h" -long pty_getpty (fd, slave, slavelength) - int slavelength; - int *fd; char *slave; +long +ptyint_getpty_ext(int *fd, char *slave, int slavelength, int do_grantpt) { +#if !defined(HAVE__GETPTY) && !defined(HAVE_OPENPTY) char *cp; char *p; int i,ptynum; struct stat stb; char slavebuf[1024]; +#endif + #ifdef HAVE__GETPTY char *slaveret; /*Temporary to hold pointer to slave*/ #endif /*HAVE__GETPTY*/ @@ -76,7 +78,8 @@ long pty_getpty (fd, slave, slavelength) if (*fd >= 0) { #if defined(HAVE_GRANTPT)&&defined(HAVE_STREAMS) - if (grantpt(*fd) || unlockpt(*fd)) return PTY_GETPTY_STREAMS; + if (do_grantpt) + if (grantpt(*fd) || unlockpt(*fd)) return PTY_GETPTY_STREAMS; #endif #ifdef HAVE_PTSNAME @@ -139,3 +142,9 @@ long pty_getpty (fd, slave, slavelength) #endif /*HAVE__GETPTY*/ #endif /* HAVE_OPENPTY */ } + +long +pty_getpty(int *fd, char *slave, int slavelength) +{ + return ptyint_getpty_ext(fd, slave, slavelength, 1); +} |