aboutsummaryrefslogtreecommitdiffstats
path: root/ftp/gftp/files/patch-lib-pty.c
blob: 9b0e8224fcc7398620444800b63d893e6331c81c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- lib/pty.c.orig	2022-02-15 06:31:19 UTC
+++ lib/pty.c
@@ -91,7 +91,9 @@ _gftp_ptys_open (int fdm, int fds, char *pts_name)
 #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 *
@@ -118,8 +120,10 @@ _gftp_ptys_open (int fdm, int fds, char *pts_name)
 static int
 _gftp_ptys_open (int fdm, int fds, char *pts_name)
 {
-  if (login_tty (fds) < 0)
+  if (login_tty (fds) < 0) {
+    close(fds);
     return (GFTP_EFATAL);
+  }
 
   return (fds);
 }