108c96f8e4
on NetBSD and probably elsewhere. Because the build wasn't stopping on error, prior builds of this package "succeeded" and generated a shared library missing some code. For this reason, bump both PKGREVISION and BUILDLINK_ABI_DEPENDS.
138 lines
4.2 KiB
Text
138 lines
4.2 KiB
Text
$NetBSD: patch-cj,v 1.2 2008/08/30 20:01:28 dholland Exp $
|
|
|
|
--- lib/libxview/ttysw/tty_init.c.orig 1993-06-29 01:17:19.000000000 -0400
|
|
+++ lib/libxview/ttysw/tty_init.c 2008-08-30 14:57:05.000000000 -0400
|
|
@@ -14,6 +14,7 @@ static char sccsid[] = "@(#)tty_init
|
|
* Ttysw initialization, destruction and error procedures
|
|
*/
|
|
|
|
+#include <sys/param.h>
|
|
#include <sys/time.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
@@ -82,7 +83,11 @@ static char sccsid[] = "@(#)tty_init
|
|
|
|
extern char *strncpy();
|
|
extern char *strcpy();
|
|
+#if (defined(BSD) && (BSD >= 199306))
|
|
+extern off_t lseek();
|
|
+#else
|
|
extern long lseek();
|
|
+#endif
|
|
char *textsw_checkpoint_undo();
|
|
|
|
/* static */ void ttysw_parseargs();
|
|
@@ -106,6 +111,7 @@ Xv_private char *xv_font_monospace();
|
|
|
|
extern int ttysel_use_seln_service;
|
|
|
|
+static int ttyinit();
|
|
|
|
struct ttysw_createoptions {
|
|
int becomeconsole; /* be the console */
|
|
@@ -432,10 +438,8 @@ ttysw_fork_it(ttysw0, argv, wfd)
|
|
char appname[20];
|
|
char *p;
|
|
unsigned ttysw_error_sleep = 1;
|
|
-#ifndef SVR4
|
|
- struct sigvec vec, ovec;
|
|
-#else
|
|
struct sigaction vec, ovec;
|
|
+#ifdef SVR4
|
|
extern char *ptsname();
|
|
|
|
#define BSD_TTY_COMPAT /* yank this if csh ever gets ported properly */
|
|
@@ -461,27 +465,6 @@ ttysw_fork_it(ttysw0, argv, wfd)
|
|
}
|
|
|
|
/* Set up the child characteristics */
|
|
-#ifndef SVR4 /* SunOS4.x code */
|
|
- vec.sv_handler = SIG_DFL;
|
|
- vec.sv_mask = vec.sv_onstack = 0;
|
|
- sigvec(SIGWINCH, &vec, 0);
|
|
- /*
|
|
- * Become session leader, change process group of child
|
|
- * process (me at this point in code) so
|
|
- * its signal stuff doesn't affect the terminal emulator.
|
|
- */
|
|
- setsid();
|
|
- vec.sv_handler = SIG_IGN;
|
|
- vec.sv_mask = vec.sv_onstack = 0;
|
|
- sigvec(SIGTTOU, &vec, &ovec);
|
|
-
|
|
- close(ttysw->ttysw_tty);
|
|
-
|
|
- /* Make the following file descriptor be my controlling terminal */
|
|
- ttysw->ttysw_tty = open("/dev/tty", O_RDWR, 0); /* open master tty* */
|
|
- sigvec(SIGTTOU, &ovec, 0);
|
|
-
|
|
-#else /* SVR4 code */
|
|
vec.sa_handler = SIG_DFL;
|
|
sigemptyset(&vec.sa_mask);
|
|
vec.sa_flags = SA_RESTART;
|
|
@@ -497,13 +480,19 @@ ttysw_fork_it(ttysw0, argv, wfd)
|
|
vec.sa_flags = SA_RESTART;
|
|
sigaction(SIGTTOU, &vec, &ovec);
|
|
|
|
+#ifndef SVR4 /* SunOS4.x code */
|
|
+ close(ttysw->ttysw_tty);
|
|
+
|
|
+ /* Make the following file descriptor be my controlling terminal */
|
|
+ ttysw->ttysw_tty = open("/dev/tty", O_RDWR, 0); /* open master tty* */
|
|
+#else /* SVR4 code */
|
|
if (unlockpt(ttysw->ttysw_pty) == -1)
|
|
perror("unlockpt (2)");
|
|
if ((ttysw->ttysw_tty = open(ptsname(ttysw->ttysw_pty),O_RDWR))<0)
|
|
return -1;
|
|
+#endif /* SVR4 */
|
|
|
|
sigaction(SIGTTOU, &ovec, (struct sigaction *) 0);
|
|
-#endif /* SVR4 */
|
|
|
|
/*
|
|
* Initialize file descriptors. Connections to servers are marked as
|
|
@@ -518,6 +507,9 @@ ttysw_fork_it(ttysw0, argv, wfd)
|
|
(void) dup2(ttysw->ttysw_tty, 2);
|
|
(void) close(ttysw->ttysw_tty);
|
|
|
|
+#if (defined(BSD) && (BSD >= 199103))
|
|
+ (void) ioctl(0, TIOCSCTTY, NULL);
|
|
+#endif
|
|
if (*argv == (char *) NULL || strcmp("-c", *argv) == 0) {
|
|
/* Process arg list */
|
|
int argc;
|
|
@@ -955,7 +947,11 @@ updateutmp(username, ttyslotuse, ttyfd)
|
|
struct utmpx utmp;
|
|
#endif
|
|
struct passwd *passwdent;
|
|
+#if !(defined(BSD) && (BSD >= 199103))
|
|
extern struct passwd *getpwuid();
|
|
+#else
|
|
+ struct passwd *getpwuid __P((uid_t));
|
|
+#endif
|
|
int f;
|
|
char *ttyn;
|
|
extern char *ttyname();
|
|
@@ -1007,13 +1003,22 @@ updateutmp(username, ttyslotuse, ttyfd)
|
|
XV_MSG("Add tty[qrs][0-f] to /etc/ttys file.\n"));
|
|
return (0);
|
|
}
|
|
+#if !(defined(BSD) && (BSD >= 199103))
|
|
if ((f = open("/etc/utmp", 1)) >= 0) {
|
|
+#else
|
|
+ if ((f = open(_PATH_UTMP, 1)) >= 0) {
|
|
+#endif
|
|
(void) lseek(f, (long) (ttyslotuse * sizeof(utmp)), 0);
|
|
(void) write(f, (char *) &utmp, sizeof(utmp));
|
|
(void) close(f);
|
|
} else {
|
|
(void) fprintf(stderr,
|
|
+#if !(defined(BSD) && (BSD >= 199103))
|
|
XV_MSG("make sure that you can write /etc/utmp!\n"));
|
|
+#else
|
|
+ XV_MSG("make sure that you can write "));
|
|
+ (void) fprintf(stderr, "%s!\n", _PATH_UTMP);
|
|
+#endif
|
|
return (0);
|
|
}
|
|
return (ttyslotuse);
|