Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1585714
 поиск   регистрация   авторизация 
 
Группа :: Графические оболочки/KDE
Пакет: kdelibs

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: kpty-3.2.2.patch


--- kdelibs-3.2.2/configure.in.in~	2004-02-13 16:56:32 +0300
+++ kdelibs-3.2.2/configure.in.in	2004-02-13 16:56:45 +0300
@@ -330,7 +330,7 @@
 AC_MSG_RESULT($kde_distribution_text)
 
 kde_have_utempter=yes
-AC_CHECK_LIB(utempter, addToUtmp, [LIBUTEMPTER=-lutempter], kde_have_utempter=no)
+AC_CHECK_LIB(utempter, utempter_add_record, [LIBUTEMPTER=-lutempter], kde_have_utempter=no)
 AC_SUBST(LIBUTEMPTER)
 if test "$kde_have_utempter" = "yes"; then
   AC_DEFINE_UNQUOTED(HAVE_UTEMPTER, 1, [Define if you have the utempter helper for utmp managment])
--- kdelibs-3.2.2/kdecore/Makefile.am~	2004-02-13 16:54:30 +0300
+++ kdelibs-3.2.2/kdecore/Makefile.am	2004-02-13 16:54:59 +0300
@@ -110,7 +110,7 @@
 	kuser.cpp kconfigskeleton.cpp kconfigdialogmanager.cpp
 
 libkdecore_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) -version-info 6:0:2 -no-undefined
-libkdecore_la_LIBADD = malloc/libklmalloc.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) ../kdefx/libkdefx.la -lidn
+libkdecore_la_LIBADD = malloc/libklmalloc.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) ../kdefx/libkdefx.la -lidn  $(LIBUTEMPTER)
 libkdecore_la_NMCHECK = $(srcdir)/libkdecore.nmcheck
 libkdecore_la_NMCHECKWEAK = $(srcdir)/libkdecore_weak.nmcheck $(srcdir)/libqt-mt_weak.nmcheck \
 	$(top_srcdir)/dcop/libDCOP_weak.nmcheck $(top_srcdir)/kdecore/standard_weak.nmcheck
--- kdelibs-3.2.2/kdecore/kpty.cpp~	2004-05-14 12:21:52 +0400
+++ kdelibs-3.2.2/kdecore/kpty.cpp	2004-05-14 12:24:54 +0400
@@ -137,6 +137,7 @@ extern "C" {
 // private functions //
 ///////////////////////
 
+#if 0
 #ifdef HAVE_UTEMPTER
 class KProcess_Utmp : public KProcess
 {
@@ -153,7 +154,11 @@ public:
 #endif
 
 #define BASE_CHOWN "kgrantpty"
-
+#endif
+#ifdef HAVE_UTEMPTER
+#include <utempter.h>
+#include <sys/param.h>
+#endif
 
 
 //////////////////
@@ -195,6 +200,18 @@ KPty::~KPty()
   
 bool KPty::open()
 {
+  if (d->masterFd >= 0) return true;
+
+  char *n = new char[64];
+  int ret = ::openpty(&d->masterFd, &d->slaveFd, n, NULL, NULL);
+  if( ret < 0 )
+  {
+    perror("openpty");
+    return false;
+  }
+  d->ttyName = QCString(n);
+
+#if 0 //old code
   if (d->masterFd >= 0)
     return true;
 
@@ -309,6 +326,8 @@ bool KPty::open()
   ioctl(d->slaveFd, I_PUSH, "ldterm");
 #endif
 
+#endif // old code
+
     // set xon/xoff & control keystrokes
   // without the '::' some version of HP-UX thinks, this declares
   // the struct in this class, in this method, and fails to find 
@@ -387,10 +406,7 @@ void KPty::setCTty()
 void KPty::login(const char *user, const char *remotehost)
 {
 #ifdef HAVE_UTEMPTER
-    KProcess_Utmp utmp;
-    utmp.cmdFd = d->masterFd;
-    utmp << "/usr/sbin/utempter" << "-a" << d->ttyName << "";
-    utmp.start(KProcess::Block);
+    utempter_add_record( d->masterFd, remotehost);
     Q_UNUSED(user);
     Q_UNUSED(remotehost);
 #elif defined(USE_LOGIN)
@@ -430,10 +446,7 @@ void KPty::login(const char *user, const
 void KPty::logout()
 {
 #ifdef HAVE_UTEMPTER
-    KProcess_Utmp utmp;
-    utmp.cmdFd = d->masterFd;
-    utmp << "/usr/sbin/utempter" << "-d" << d->ttyName;
-    utmp.start(KProcess::Block);
+    utempter_remove_added_record();
 #elif defined(USE_LOGIN)
     const char *str_ptr = d->ttyName.data();
     if (!memcmp(str_ptr, "/dev/", 5))
@@ -495,8 +508,11 @@ int KPty::slaveFd() const
 // private
 bool KPty::chownpty(bool grant)
 {
+  return true;
+#if 0
   KProcess proc;
   proc << locate("exe", BASE_CHOWN) << (grant?"--grant":"--revoke") << QString::number(d->masterFd);
   return proc.start(KProcess::Block) && proc.normalExit() && !proc.exitStatus();
+#endif
 }
 
 
design & coding: Vladimir Lettiev aka crux © 2004-2005