|
|
@ -203,12 +203,9 @@ KPty::~KPty()
|
|
|
|
|
|
|
|
|
|
|
|
bool KPty::setPty(int pty_master)
|
|
|
|
bool KPty::setPty(int pty_master)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kdWarning(175)
|
|
|
|
|
|
|
|
<< "setPty()" << endl;
|
|
|
|
|
|
|
|
// a pty is already open
|
|
|
|
// a pty is already open
|
|
|
|
if(d->masterFd >= 0) {
|
|
|
|
if(d->masterFd >= 0) {
|
|
|
|
kdWarning(175)
|
|
|
|
kdWarning(175) << "KPty::setPty(): " << "d->masterFd >= 0" << endl;
|
|
|
|
<< "d->masterFd >= 0" << endl;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
d->masterFd = pty_master;
|
|
|
|
d->masterFd = pty_master;
|
|
|
@ -219,8 +216,7 @@ bool KPty::_attachPty(int pty_master)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQCString ptyName;
|
|
|
|
TQCString ptyName;
|
|
|
|
|
|
|
|
|
|
|
|
kdWarning(175)
|
|
|
|
kdDebug(175) << "KPty::_attachPty(): " << pty_master << endl;
|
|
|
|
<< "_attachPty() " << pty_master << endl;
|
|
|
|
|
|
|
|
#if defined(HAVE_PTSNAME) && defined(HAVE_GRANTPT)
|
|
|
|
#if defined(HAVE_PTSNAME) && defined(HAVE_GRANTPT)
|
|
|
|
char *ptsn = ptsname(d->masterFd);
|
|
|
|
char *ptsn = ptsname(d->masterFd);
|
|
|
|
if (ptsn) {
|
|
|
|
if (ptsn) {
|
|
|
@ -242,8 +238,8 @@ bool KPty::_attachPty(int pty_master)
|
|
|
|
!chownpty(true))
|
|
|
|
!chownpty(true))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kdWarning(175)
|
|
|
|
kdWarning(175)
|
|
|
|
<< "chownpty failed for device " << ptyName << "::" << d->ttyName
|
|
|
|
<< "KPty::_attachPty(): " << "chownpty failed for device " << ptyName << "::" << d->ttyName << endl
|
|
|
|
<< "\nThis means the communication can be eavesdropped." << endl;
|
|
|
|
<< "KPty::_attachPty(): " << "This means the communication can be eavesdropped." << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef BSD
|
|
|
|
#ifdef BSD
|
|
|
@ -257,7 +253,7 @@ bool KPty::_attachPty(int pty_master)
|
|
|
|
d->slaveFd = ::open(d->ttyName.data(), O_RDWR | O_NOCTTY);
|
|
|
|
d->slaveFd = ::open(d->ttyName.data(), O_RDWR | O_NOCTTY);
|
|
|
|
if (d->slaveFd < 0)
|
|
|
|
if (d->slaveFd < 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kdWarning(175) << "Can't open slave pseudo teletype" << endl;
|
|
|
|
kdWarning(175) << "KPty::_attachPty(): " << "Can't open slave pseudo teletype" << endl;
|
|
|
|
::close(d->masterFd);
|
|
|
|
::close(d->masterFd);
|
|
|
|
d->masterFd = -1;
|
|
|
|
d->masterFd = -1;
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -381,7 +377,7 @@ bool KPty::open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kdWarning(175) << "Can't open a pseudo teletype" << endl;
|
|
|
|
kdWarning(175) << "KPty::open(): " << "Can't open a pseudo teletype" << endl;
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
gotpty:
|
|
|
|
gotpty:
|
|
|
|