Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-gnome
Path: blob/main/ftp/gftp/files/patch-lib-pty.c
16151 views
1
--- lib/pty.c.orig 2007-03-13 02:56:43.000000000 +0100
2
+++ lib/pty.c 2010-01-17 17:34:25.000000000 +0100
3
@@ -59,6 +59,50 @@
4
return (new_fds);
5
}
6
7
+#elif HAVE_OPENPTY
8
+
9
+#ifdef HAVE_PTY_H
10
+#include <pty.h>
11
+#include <utmp.h> /* for login_tty */
12
+#elif HAVE_LIBUTIL_H
13
+#include <libutil.h>
14
+#else
15
+extern int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize * winp);
16
+extern int login_tty(int fd);
17
+#endif
18
+
19
+char *
20
+gftp_get_pty_impl (void)
21
+{
22
+ return ("openpty");
23
+}
24
+
25
+
26
+static int
27
+_gftp_ptym_open (char *pts_name, size_t len, int *fds)
28
+{
29
+ int fdm;
30
+
31
+ if (openpty (&fdm, fds, pts_name, NULL, NULL) < 0)
32
+ return (GFTP_ERETRYABLE);
33
+
34
+ ioctl (*fds, TIOCSCTTY, NULL);
35
+
36
+ return (fdm);
37
+}
38
+
39
+
40
+static int
41
+_gftp_ptys_open (int fdm, int fds, char *pts_name)
42
+{
43
+ if (login_tty (fds) < 0) {
44
+ close(fds);
45
+ return (GFTP_EFATAL);
46
+ }
47
+
48
+ return (fds);
49
+}
50
+
51
#elif HAVE_GRANTPT
52
53
#if !(defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__))
54
@@ -131,49 +192,6 @@
55
return (new_fds);
56
}
57
58
-#elif HAVE_OPENPTY
59
-
60
-#ifdef HAVE_PTY_H
61
-#include <pty.h>
62
-#include <utmp.h> /* for login_tty */
63
-#elif HAVE_LIBUTIL_H
64
-#include <libutil.h>
65
-#include <utmp.h> /* for login_tty */
66
-#else
67
-extern int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize * winp);
68
-extern int login_tty(int fd);
69
-#endif
70
-
71
-char *
72
-gftp_get_pty_impl (void)
73
-{
74
- return ("openpty");
75
-}
76
-
77
-
78
-static int
79
-_gftp_ptym_open (char *pts_name, size_t len, int *fds)
80
-{
81
- int fdm;
82
-
83
- if (openpty (&fdm, fds, pts_name, NULL, NULL) < 0)
84
- return (GFTP_ERETRYABLE);
85
-
86
- ioctl (*fds, TIOCSCTTY, NULL);
87
-
88
- return (fdm);
89
-}
90
-
91
-
92
-static int
93
-_gftp_ptys_open (int fdm, int fds, char *pts_name)
94
-{
95
- if (login_tty (fds) < 0)
96
- return (GFTP_EFATAL);
97
-
98
- return (fds);
99
-}
100
-
101
#else
102
103
/* Fall back to *BSD... */
104
105