MCPcopy Create free account
hub / github.com/F-Stack/f-stack / login_tty

Function login_tty

tools/libutil/login_tty.c:43–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41#include <unistd.h>
42
43int
44login_tty(int fd)
45{
46 pid_t s;
47
48 s = setsid();
49 if (s == -1)
50 s = getsid(0);
51 if (tcsetsid(fd, s) == -1)
52 return (-1);
53 (void) dup2(fd, 0);
54 (void) dup2(fd, 1);
55 (void) dup2(fd, 2);
56 if (fd > 2)
57 (void) close(fd);
58 return (0);
59}

Callers 1

forkptyFunction · 0.85

Calls 1

closeFunction · 0.50

Tested by

no test coverage detected