Mercurial > gftp.yaz
changeset 515:cb78cf311d23
2004-7-26 Brian Masney <masneyb@gftp.org>
* lib/pty.c - give the grantpt pty implementation more priority over
using openpty()
author | masneyb |
---|---|
date | Mon, 26 Jul 2004 09:51:07 +0000 |
parents | e55d8b35d809 |
children | fbb5a02beddb |
files | ChangeLog lib/pty.c |
diffstat | 2 files changed, 49 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jul 25 15:48:25 2004 +0000 +++ b/ChangeLog Mon Jul 26 09:51:07 2004 +0000 @@ -1,3 +1,7 @@ +2004-7-26 Brian Masney <masneyb@gftp.org> + * lib/pty.c - give the grantpt pty implementation more priority over + using openpty() + 2004-7-25 Brian Masney <masneyb@gftp.org> * src/gtk/bookmarks.c src/gtk/gftp-gtk.c src/gtk/gtkui.c src/gtk/transfer.c src/text/textui.c src/uicommon/gftpui.c @@ -2635,7 +2639,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.292 2004/07/25 15:48:25 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.293 2004/07/26 09:51:07 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/pty.c Sun Jul 25 15:48:25 2004 +0000 +++ b/lib/pty.c Mon Jul 26 09:51:07 2004 +0000 @@ -60,49 +60,6 @@ return (new_fds); } -#elif HAVE_OPENPTY - -#ifdef HAVE_PTY_H -#include <pty.h> -#include <utmp.h> /* for login_tty */ -#elif HAVE_LIBUTIL_H -#include <libutil.h> -#include <utmp.h> /* for login_tty */ -#else -extern int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize * winp); -extern int login_tty(int fd); -#endif - -char * -gftp_get_pty_impl (void) -{ - return ("openpty"); -} - - -static int -_gftp_ptym_open (char *pts_name, size_t len, int *fds) -{ - int fdm; - - if (openpty (&fdm, fds, pts_name, NULL, NULL) < 0) - return (GFTP_ERETRYABLE); - - ioctl (*fds, TIOCSCTTY, NULL); - - return (fdm); -} - - -static int -_gftp_ptys_open (int fdm, int fds, char *pts_name) -{ - if (login_tty (fds) < 0) - return (GFTP_EFATAL); - - return (fds); -} - #elif HAVE_GRANTPT #include <stropts.h> @@ -169,7 +126,50 @@ return (new_fds); } -#else /* !HAVE_GRANTPT */ +#elif HAVE_OPENPTY + +#ifdef HAVE_PTY_H +#include <pty.h> +#include <utmp.h> /* for login_tty */ +#elif HAVE_LIBUTIL_H +#include <libutil.h> +#include <utmp.h> /* for login_tty */ +#else +extern int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize * winp); +extern int login_tty(int fd); +#endif + +char * +gftp_get_pty_impl (void) +{ + return ("openpty"); +} + + +static int +_gftp_ptym_open (char *pts_name, size_t len, int *fds) +{ + int fdm; + + if (openpty (&fdm, fds, pts_name, NULL, NULL) < 0) + return (GFTP_ERETRYABLE); + + ioctl (*fds, TIOCSCTTY, NULL); + + return (fdm); +} + + +static int +_gftp_ptys_open (int fdm, int fds, char *pts_name) +{ + if (login_tty (fds) < 0) + return (GFTP_EFATAL); + + return (fds); +} + +#else /* Fall back to *BSD... */