mailing list of musl libc
 help / color / mirror / code / Atom feed
4a1ea9b7d24e423f6289050a147570a9fc1b9200 blob 456 bytes (raw)

 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
 
#include <pty.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>

int forkpty(int *m, char *name, const struct termios *tio, const struct winsize *ws)
{
	int s;
	pid_t pid;

	if (openpty(m, &s, name, tio, ws) < 0) return -1;

	pid = fork();
	if (!pid) {
		close(*m);
		setsid();
		ioctl(s, TIOCSCTTY, (char *)0);
		dup2(s, 0);
		dup2(s, 1);
		dup2(s, 2);
		if (s>2) close(s);
		return 0;
	}
	close(s);
	if (pid < 0) close(*m);
	return pid;
}
debug log:

solving 4a1ea9b ...
found 4a1ea9b in https://inbox.vuxu.org/musl/20141101222729.GB5949@euler/
found 07f8d01 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 07f8d01eed66741e31ec3c83a07ab5d4306d2fd0	src/misc/forkpty.c

applying [1/1] https://inbox.vuxu.org/musl/20141101222729.GB5949@euler/
diff --git a/src/misc/forkpty.c b/src/misc/forkpty.c
index 07f8d01..4a1ea9b 100644

Checking patch src/misc/forkpty.c...
Applied patch src/misc/forkpty.c cleanly.

index at:
100644 4a1ea9b7d24e423f6289050a147570a9fc1b9200	src/misc/forkpty.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).