command-not-found: Update with new executables
[termux-packages] / packages / tmux / tmux.patch
CommitLineData
59f0d218
FF
1diff -u -r -N ../tmux-1.8/compat/forkpty-linux.c ./compat/forkpty-linux.c
2--- ../tmux-1.8/compat/forkpty-linux.c 1970-01-01 01:00:00.000000000 +0100
3+++ ./compat/forkpty-linux.c 2014-01-08 12:44:00.885192436 +0100
4@@ -0,0 +1,63 @@
5+#include <fcntl.h>
6+#include <sys/ioctl.h>
7+#include <sys/param.h>
8+#include <sys/types.h>
9+#include <stdlib.h>
10+#include <termios.h>
11+#include <unistd.h>
12+
13+int login_tty(int fd)
14+{
15+ setsid();
16+ if (ioctl(fd, TIOCSCTTY, NULL) == -1) return -1;
17+ dup2(fd, 0);
18+ dup2(fd, 1);
19+ dup2(fd, 2);
20+ if (fd > 2) close(fd);
21+ return 0;
22+}
23+
24+int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp)
25+{
26+ char buf[512];
27+ int master, slave;
28+
29+ master = open("/dev/ptmx", O_RDWR);
30+ if (master == -1) return -1;
31+ if (grantpt(master) || unlockpt(master) || ptsname_r(master, buf, sizeof buf)) goto fail;
32+
33+ slave = open(buf, O_RDWR | O_NOCTTY);
34+ if (slave == -1) goto fail;
35+
36+ /* XXX Should we ignore errors here? */
37+ if (termp) tcsetattr(slave, TCSAFLUSH, termp);
38+ if (winp) ioctl(slave, TIOCSWINSZ, winp);
39+
40+ *amaster = master;
41+ *aslave = slave;
42+ if (name != NULL) strcpy(name, buf);
43+ return 0;
44+
45+fail:
46+ close(master);
47+ return -1;
48+}
49+
50+
51+int forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
52+{
53+ int master, slave, pid;
54+ if (openpty(&master, &slave, name, termp, winp) == -1) return -1;
55+ switch (pid = fork()) {
56+ case -1:
57+ return -1;
58+ case 0:
59+ close(master);
60+ if (login_tty (slave)) _exit (1);
61+ return 0;
62+ default:
63+ *amaster = master;
64+ close (slave);
65+ return pid;
66+ }
67+}
68diff -u -r -N ../tmux-1.8/compat/imsg-buffer.c ./compat/imsg-buffer.c
69--- ../tmux-1.8/compat/imsg-buffer.c 2013-02-10 17:20:15.000000000 +0100
70+++ ./compat/imsg-buffer.c 2014-01-08 12:33:53.721206934 +0100
71@@ -28,6 +28,10 @@
72
73 #include "tmux.h"
74
75+#ifndef IOV_MAX
76+# define IOV_MAX 1024
77+#endif
78+
79 int ibuf_realloc(struct ibuf *, size_t);
80 void ibuf_enqueue(struct msgbuf *, struct ibuf *);
81 void ibuf_dequeue(struct msgbuf *, struct ibuf *);