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:29:21 +0200
commite469e42c76000b70aebaf838f5a3c4ded184b0e3 (patch)
treed3c30d649702aa97c9c2b59e80c9901ddb530a65 /tdecore/kpty.cpp
parente75569be1b7bf138685d0e4941daf111e6f51ba3 (diff)
downloadtdelibs-e469e42c76000b70aebaf838f5a3c4ded184b0e3.tar.gz
tdelibs-e469e42c76000b70aebaf838f5a3c4ded184b0e3.zip
Fix several issues on freebsd
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
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();