Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Added auth to xserver |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
c6253f528279f9c144280129fa116c27 |
| User & Date: | jmcclure 2018-01-04 21:35:11 |
Context
|
2018-04-15
| ||
| 01:37 | updated urls in info.html; replaced wmutil with muswm; key forwarding added to tmuxwm check-in: 2510850a62 user: jmcclure tags: trunk | |
|
2018-01-04
| ||
| 21:35 | Added auth to xserver check-in: c6253f5282 user: jmcclure tags: trunk | |
| 03:16 | Typo check-in: a44a985780 user: jmcclure tags: trunk | |
Changes
Changes to xi.c.
| ︙ | ︙ | |||
31 32 33 34 35 36 37 |
static volatile int xrunning = 0;
void handler(int sig) {
if (sig == SIGUSR1) xrunning = 1;
if (sig == SIGCHLD || sig == SIGTERM) xrunning = 0;
}
| | | | < < > > | | < | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
static volatile int xrunning = 0;
void handler(int sig) {
if (sig == SIGUSR1) xrunning = 1;
if (sig == SIGCHLD || sig == SIGTERM) xrunning = 0;
}
int server(const char *dpy, const char *tty, const char *xauth) {
const char *xorg = "/usr/lib/xorg-server/Xorg";
int pid;
if ((pid=fork()) < 0) exit(1);
else if (pid > 0) return pid;
signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
execl(xorg, xorg, dpy, tty, "-keeptty", "-nolisten", "tcp", "-quiet", "-auth", xauth, NULL);
_exit(2);
}
int client(const char *dpy, const char *wm, const char *xauth) {
int pid;
if ((pid=fork()) < 0) exit(3);
else if (pid > 0) return pid;
setenv("XAUTHORITY", xauth, 1);
setenv("DISPLAY", dpy, 1);
execlp(wm, wm, NULL);
_exit(4);
}
int main(int argc, const char **argv) {
struct vt_stat vtstat;
if (ioctl(0, VT_GETSTATE, &vtstat)) {
perror("get_vt");
return 1;
}
char dpy[] = { ':', '0' + vtstat.v_active, 0 };
char tty[] = { 'v', 't', '0' + vtstat.v_active, 0 };
char xauth[PATH_MAX];
snprintf(xauth, PATH_MAX, "%s/%s", getenv("HOME"), ".Xauthority");
struct sigaction sa = { 0, 0, 0, 0, 0 };
sa.sa_handler = handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGUSR1, &sa, NULL);
sigaction(SIGCHLD, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
int xpid = server(dpy, tty, xauth);
while (!xrunning) pause();
int cpid = client(dpy, (argc > 1 ? argv[1] : ".xirc" ), xauth);
while (xrunning) pause();
kill(cpid, SIGTERM);
waitpid(cpid, NULL, 0);
kill(xpid, SIGTERM);
waitpid(xpid, NULL, 0);
return 0;
}
|