aboutsummaryrefslogtreecommitdiff
path: root/x11/kdebase3/files
diff options
context:
space:
mode:
authorKevin Lo <kevlo@FreeBSD.org>2000-12-12 03:02:24 +0000
committerKevin Lo <kevlo@FreeBSD.org>2000-12-12 03:02:24 +0000
commitcef8910eaaa9c2946347c51fcaa42d77f66c5f43 (patch)
treee0e894c20df7100254c443299fe8737f905379be /x11/kdebase3/files
parentd19a1256af034aa3c15add1a3f5c20a19f53f0a4 (diff)
downloadports-cef8910eaaa9c2946347c51fcaa42d77f66c5f43.tar.gz
ports-cef8910eaaa9c2946347c51fcaa42d77f66c5f43.zip
Notes
Diffstat (limited to 'x11/kdebase3/files')
-rw-r--r--x11/kdebase3/files/patch-TEPty.C87
-rw-r--r--x11/kdebase3/files/patch-konsole_grantpty.c79
2 files changed, 161 insertions, 5 deletions
diff --git a/x11/kdebase3/files/patch-TEPty.C b/x11/kdebase3/files/patch-TEPty.C
index 9a5ece3b2ab3..9bfd5db25ccd 100644
--- a/x11/kdebase3/files/patch-TEPty.C
+++ b/x11/kdebase3/files/patch-TEPty.C
@@ -1,11 +1,88 @@
---- konsole/src/TEPty.C Tue Oct 3 14:57:30 2000
-+++ konsole/src/TEPty.C.new Thu Nov 2 17:51:30 2000
-@@ -225,7 +225,7 @@
+--- konsole/src/TEPty.C.orig Fri Dec 8 11:51:24 2000
++++ konsole/src/TEPty.C Fri Dec 8 11:52:51 2000
+@@ -180,27 +180,57 @@
+ // param grant: 1 to grant, 0 to revoke
+ // returns 1 on success 0 on fail
+ {
+- pid_t pid = fork();
+- if (pid < 0)
+- {
+- return 0;
+- }
+- if (pid == 0)
+- {
+- /* We pass the master pseudo terminal as file descriptor PTY_FILENO. */
+- if (fd != PTY_FILENO && dup2(fd, PTY_FILENO) < 0) exit(1);
+- QString path = locate("exe", BASE_CHOWN);
++ pid_t pid;
++ int pstat;
++ struct sigaction ign;
++ struct sigaction intact; // interupt action
++ struct sigaction quitact; // quit action
++ sigset_t newsigblock, oldsigblock;
++ QString path;
++
++ ign.sa_handler = SIG_IGN;
++ sigemptyset(&ign.sa_mask);
++ ign.sa_flags = 0;
++ sigaction(SIGINT, &ign, &intact);
++ sigaction(SIGQUIT, &ign, &quitact);
++ sigemptyset(&newsigblock);
++ sigaddset(&newsigblock, SIGCHLD);
++ sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
++
++ switch (pid = fork()) {
++ case -1:
++ return(0);
++ break;
++ case 0: // child
++ if (fd != PTY_FILENO && dup2(fd, PTY_FILENO) < 0)
++ exit(1);
++ path = locate("exe", BASE_CHOWN);
++
++ sigaction(SIGINT, &intact, NULL);
++ sigaction(SIGQUIT, &quitact, NULL);
++ sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ execle(path.ascii(), BASE_CHOWN, grant?"--grant":"--revoke", NULL, NULL);
+- exit(1); // should not be reached
+- }
+- if (pid > 0)
+- { int w;
+- retry:
+- int rc = waitpid (pid, &w, 0);
+- if ((rc == -1) && (errno == EINTR))
+- goto retry;
+- return (rc != -1 && WIFEXITED(w) && WEXITSTATUS(w) == 0);
++ exit(1);
++ break;
++ default:
++ do {
++ pid = waitpid(pid, &pstat, 0);
++ } while (pid == -1 && errno == EINTR);
++ break;
+ }
++ sigaction(SIGINT, &intact, NULL);
++ sigaction(SIGQUIT, &quitact, NULL);
++ sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
++
++ if (pid == -1) {
++ return 0;
++ }
++ else if (WIFEXITED(pstat) && (WEXITSTATUS(pstat) == 0)) {
++ return 1;
++ }
++ else {
++ return 0;
++ }
+ return 0; //dummy.
+ }
+
+@@ -225,7 +255,7 @@
#ifdef HAVE_UTEMPTER
removeLineFromUtmp(ttynam, fd);
#elif defined(USE_LOGIN)
- char *tty_name=ttyname(0);
+ char *tty_name=ttyname(fd);
if (tty_name)
- logout(tty_name);
- #endif
+ {
+ if (strncmp(tty_name, "/dev/", 5) == 0)
diff --git a/x11/kdebase3/files/patch-konsole_grantpty.c b/x11/kdebase3/files/patch-konsole_grantpty.c
new file mode 100644
index 000000000000..889d15bdb592
--- /dev/null
+++ b/x11/kdebase3/files/patch-konsole_grantpty.c
@@ -0,0 +1,79 @@
+--- konsole/src/konsole_grantpty.c.orig Sat Jun 12 07:13:31 1999
++++ konsole/src/konsole_grantpty.c Fri Dec 8 11:54:43 2000
+@@ -31,13 +31,15 @@
+ #include <string.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
++#include <dirent.h>
++#include <paths.h>
+
+ #define PTY_FILENO 3 /* keep in sync with grantpty */
+ #define TTY_GROUP "tty"
+
+ int main (int argc, char *argv[])
+ {
+- char* pty;
++ char* pty = NULL;
+ struct stat st;
+ struct group* p;
+ gid_t gid;
+@@ -81,6 +83,7 @@
+
+ /* get slave pty name from master pty file handle in PTY_FILENO *********/
+
++#if 0
+ /* Check that PTY_FILENO is a valid master pseudo terminal. */
+ pty = ttyname(PTY_FILENO); /* posix */
+ if (pty == NULL)
+@@ -89,6 +92,42 @@
+ return 1; /* FAIL */
+ }
+ close(PTY_FILENO);
++#else
++ /* The trouble with the ifdef'd-out portion above is that ttyname()
++ ** does not work correctly when not passed a valid tty, but a pseudotty
++ ** instead. All we're doing here is finding out what the name of
++ ** the associated pty is without having to pass it in on the command line.
++ ** Nothing complex.
++ */
++ {
++ struct stat sb;
++ struct stat dsb;
++ struct dirent *dirp;
++ static char buf[sizeof(_PATH_DEV) + MAXNAMLEN] = _PATH_DEV;
++ DIR *dp;
++
++ pty = NULL;
++
++ if (fstat(PTY_FILENO, &sb))
++ return 1; /* FAIL */
++ if ((dp = opendir(_PATH_DEV)) == NULL)
++ return 1; /* FAIL */
++
++ while ((dirp = readdir(dp))) {
++ if (dirp->d_fileno != sb.st_ino)
++ continue;
++ bcopy(dirp->d_name, buf + sizeof(_PATH_DEV) - 1, dirp->d_namlen+1);
++ /*fprintf(stderr, "looking at %s\n", buf);*/
++ if (stat(buf, &dsb) || sb.st_dev != dsb.st_dev || sb.st_ino != dsb.st_ino)
++ continue;
++ pty = buf;
++ }
++ closedir(dp);
++ if (pty == NULL)
++ return 1; /* FAIL */
++ }
++ /*fprintf(stderr, "successful at finding %s\n", pty);*/
++#endif
+
+ /* matches /dev/pty?? */
+ if (strlen(pty) < 8 || strncmp(pty,"/dev/pty",8))
+@@ -120,6 +159,8 @@
+ fprintf(stderr,"%s: cannot chmod %s.\n",argv[0],tty); perror("Reason");
+ return 1; /* FAIL */
+ }
++
++ /*fprintf(stderr, "made it here\n");*/
+
+ return 0; /* OK */
+ }