Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/ftp/gftp/files/patch-lib-pty.c
16461 views
1
--- lib/pty.c.orig 2022-02-15 06:31:19 UTC
2
+++ lib/pty.c
3
@@ -91,7 +91,9 @@ _gftp_ptys_open (int fdm, int fds, char *pts_name)
4
#include <utmp.h> /* for login_tty */
5
#elif HAVE_LIBUTIL_H
6
#include <libutil.h>
7
-#include <utmp.h> /* for login_tty */
8
+#else
9
+extern int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize * winp);
10
+extern int login_tty(int fd);
11
#endif
12
13
char *
14
@@ -118,8 +120,10 @@ _gftp_ptys_open (int fdm, int fds, char *pts_name)
15
static int
16
_gftp_ptys_open (int fdm, int fds, char *pts_name)
17
{
18
- if (login_tty (fds) < 0)
19
+ if (login_tty (fds) < 0) {
20
+ close(fds);
21
return (GFTP_EFATAL);
22
+ }
23
24
return (fds);
25
}
26
27