blob: 9f7d3a914cb3ae92d13e5a464bf855e11533a4f7 (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
--- src/sudosh.c.orig Tue Oct 26 18:01:24 2004
+++ src/sudosh.c Thu Oct 28 15:18:50 2004
@@ -75,6 +75,12 @@
#define SIGCHLD SIGCLD
#endif
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <libutil.h>
+#endif
+
static struct termios termorig;
static struct winsize winorig;
@@ -377,15 +383,24 @@
{
if ((p->mfd = open ("/dev/ptc", O_RDWR)) == -1)
{
- perror ("Cannot open cloning master pty");
- return -1;
+#ifdef __FreeBSD__
+ if (openpty(&p->mfd, &p->sfd, sname, NULL, NULL) == -1)
+ {
+#endif
+ perror ("Cannot open cloning master pty");
+ return -1;
+#ifdef __FreeBSD__
+ }
+#endif
}
}
(void) unlockpt (p->mfd);
(void) grantpt (p->mfd);
+#ifndef __FreeBSD__
sname = (char *) ptsname (p->mfd);
+#endif
if ((p->sfd = open (sname, O_RDWR)) == -1)
{
|