summaryrefslogtreecommitdiffstats
path: root/tdecore/kpty.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2015-06-14 20:29:21 +0200
committerSlávek Banko <slavek.banko@axis.cz>2015-06-14 20:30:24 +0200
commitd8091396166f7ffd9020a78ffd9669587655f82c (patch)
tree72eb2c0e03399d7e4a11201965d2651b606f1119 /tdecore/kpty.cpp
parentb71166c66ac55345899a6998d57cc13ab3d93720 (diff)
downloadtdelibs-d8091396166f7ffd9020a78ffd9669587655f82c.tar.gz
tdelibs-d8091396166f7ffd9020a78ffd9669587655f82c.zip
Fix several issues on freebsd
Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit e469e42c76000b70aebaf838f5a3c4ded184b0e3)
Diffstat (limited to 'tdecore/kpty.cpp')
-rw-r--r--tdecore/kpty.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/tdecore/kpty.cpp b/tdecore/kpty.cpp
index 727166d87..42abd1aed 100644
--- a/tdecore/kpty.cpp
+++ b/tdecore/kpty.cpp
@@ -68,10 +68,13 @@
#include <unistd.h>
#include <grp.h>
-#if defined(HAVE_LIBUTIL_H) && (!defined(__FreeBSD__) || __FreeBSD_version < 900007)
+#if defined(HAVE_LIBUTIL_H)
# include <libutil.h>
-# define USE_LOGIN
-#elif defined(HAVE_UTIL_H)
+# if (!defined(__FreeBSD__) || __FreeBSD_version < 900007)
+# define USE_LOGIN
+# endif
+#endif
+#if defined(HAVE_UTIL_H)
# include <util.h>
# define USE_LOGIN
#endif
@@ -305,7 +308,7 @@ bool KPty::open()
if (d->masterFd >= 0)
return true;
-#if defined(__OpenBSD__)
+#if defined(__OpenBSD__) || defined(__FreeBSD__)
char cpty[16];
if (openpty(&d->masterFd, &d->slaveFd, cpty, NULL, &d->winSize) == 0) {
@@ -580,7 +583,7 @@ int KPty::slaveFd() const
// private
bool KPty::chownpty(bool grant)
{
-#if !defined(__OpenBSD__)
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
TDEProcess proc;
proc << locate("exe", BASE_CHOWN) << (grant?"--grant":"--revoke") << TQString::number(d->masterFd);
return proc.start(TDEProcess::Block) && proc.normalExit() && !proc.exitStatus();