Add support for openbsd pty in kpty

(cherry picked from commit e61585edf0)
v3.5.13-sru
François Andriot 10 years ago committed by Slávek Banko
parent e4213f01b9
commit 4ade6a8e20

@ -305,6 +305,17 @@ bool KPty::open()
if (d->masterFd >= 0)
return true;
#if defined(__OpenBSD__)
char cpty[16];
if (openpty(&d->masterFd, &d->slaveFd, cpty, NULL, &d->winSize) == 0) {
d->ttyName = cpty;
} else {
kdWarning(175) << "Can't open slave pseudo teletype" << endl;
return false;
}
#else
TQCString ptyName;
// Find a master pty that we can open ////////////////////////////////
@ -379,6 +390,7 @@ bool KPty::open()
kdWarning(175) << "KPty::open(): " << "Can't open a pseudo teletype" << endl;
return false;
#endif
gotpty:
return _attachPty(d->masterFd);
@ -568,8 +580,10 @@ int KPty::slaveFd() const
// private
bool KPty::chownpty(bool grant)
{
#if !defined(__OpenBSD__)
KProcess proc;
proc << locate("exe", BASE_CHOWN) << (grant?"--grant":"--revoke") << TQString::number(d->masterFd);
return proc.start(KProcess::Block) && proc.normalExit() && !proc.exitStatus();
#endif
}

Loading…
Cancel
Save