mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-05-03 00:38:21 +00:00
openpty: adapt variable naming
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
8ed01f3c00
commit
a143f4a563
@ -34,43 +34,43 @@
|
|||||||
|
|
||||||
#define _PATH_DEVPTMX "/dev/ptmx"
|
#define _PATH_DEVPTMX "/dev/ptmx"
|
||||||
|
|
||||||
int openpty (int *amaster, int *aslave, char *name, struct termios *termp,
|
int openpty (int *aptmx, int *apts, char *name, struct termios *termp,
|
||||||
struct winsize *winp)
|
struct winsize *winp)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
int master, slave;
|
int ptmx, pts;
|
||||||
|
|
||||||
master = open(_PATH_DEVPTMX, O_RDWR);
|
ptmx = open(_PATH_DEVPTMX, O_RDWR);
|
||||||
if (master == -1)
|
if (ptmx == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (grantpt(master))
|
if (grantpt(ptmx))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (unlockpt(master))
|
if (unlockpt(ptmx))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (ptsname_r(master, buf, sizeof buf))
|
if (ptsname_r(ptmx, buf, sizeof buf))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
slave = open(buf, O_RDWR | O_NOCTTY);
|
pts = open(buf, O_RDWR | O_NOCTTY);
|
||||||
if (slave == -1)
|
if (pts == -1)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* XXX Should we ignore errors here? */
|
/* XXX Should we ignore errors here? */
|
||||||
if (termp)
|
if (termp)
|
||||||
tcsetattr(slave, TCSAFLUSH, termp);
|
tcsetattr(pts, TCSAFLUSH, termp);
|
||||||
if (winp)
|
if (winp)
|
||||||
ioctl(slave, TIOCSWINSZ, winp);
|
ioctl(pts, TIOCSWINSZ, winp);
|
||||||
|
|
||||||
*amaster = master;
|
*aptmx = ptmx;
|
||||||
*aslave = slave;
|
*apts = pts;
|
||||||
if (name != NULL)
|
if (name != NULL)
|
||||||
strcpy(name, buf);
|
strcpy(name, buf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
close(master);
|
close(ptmx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,12 @@
|
|||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
/* Create pseudo tty master slave pair with NAME and set terminal
|
/*
|
||||||
attributes according to TERMP and WINP and return handles for both
|
* Create pseudo tty ptmx pts pair with @__name and set terminal
|
||||||
ends in AMASTER and ASLAVE. */
|
* attributes according to @__termp and @__winp and return handles for both
|
||||||
extern int openpty (int *__amaster, int *__aslave, char *__name,
|
* ends in @__aptmx and @__apts.
|
||||||
|
*/
|
||||||
|
extern int openpty (int *__aptmx, int *__apts, char *__name,
|
||||||
const struct termios *__termp,
|
const struct termios *__termp,
|
||||||
const struct winsize *__winp);
|
const struct winsize *__winp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user