summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-08-18 03:42:12 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-08-18 03:42:12 +0000
commit0b7cd0b79ac9bf9c298be7a92d3a7a15acf362fb (patch)
tree551781917849456773d00d1aa818bfcd71af553f /libexec
parentab6c05829cb449b7f110458687c81876988002c0 (diff)
TIOCNOTTY is the default in POSIX termios, no need to explicately ask for it.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/talkd/announce.c53
-rw-r--r--libexec/talkd/talkd.h3
2 files changed, 5 insertions, 51 deletions
diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c
index ec6b15697a9..b25fb2b986a 100644
--- a/libexec/talkd/announce.c
+++ b/libexec/talkd/announce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: announce.c,v 1.7 1998/07/03 14:33:38 deraadt Exp $ */
+/* $OpenBSD: announce.c,v 1.8 1998/08/18 03:42:10 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)announce.c 5.9 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: announce.c,v 1.7 1998/07/03 14:33:38 deraadt Exp $";
+static char rcsid[] = "$Id: announce.c,v 1.8 1998/08/18 03:42:10 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -45,7 +45,6 @@ static char rcsid[] = "$Id: announce.c,v 1.7 1998/07/03 14:33:38 deraadt Exp $";
#include <sys/wait.h>
#include <sys/socket.h>
#include <protocols/talkd.h>
-#include <sgtty.h>
#include <errno.h>
#include <syslog.h>
#include <unistd.h>
@@ -59,51 +58,14 @@ static char rcsid[] = "$Id: announce.c,v 1.7 1998/07/03 14:33:38 deraadt Exp $";
static void print_mesg __P((FILE *,CTL_MSG *,char *));
/*
- * Announce an invitation to talk.
- *
- * Because the tty driver insists on attaching a terminal-less
- * process to any terminal that it writes on, we must fork a child
- * to protect ourselves
+ * Announce an invitation to talk. If the user is
+ * accepting messages, announce that a talk is requested.
*/
int
announce(request, remote_machine)
CTL_MSG *request;
char *remote_machine;
{
- int pid, val, status;
-
- if (pid = fork()) {
- /* we are the parent, so wait for the child */
- if (pid == -1) /* the fork failed */
- return (FAILED);
- do {
- val = wait(&status);
- if (val == -1) {
- if (errno == EINTR)
- continue;
- /* shouldn't happen */
- syslog(LOG_WARNING, "announce: wait: %m");
- return (FAILED);
- }
- } while (val != pid);
- if (status&0377 > 0) /* we were killed by some signal */
- return (FAILED);
- /* Get the second byte, this is the exit/return code */
- return ((status >> 8) & 0377);
- }
- /* we are the child, go and do it */
- _exit(announce_proc(request, remote_machine));
-}
-
-/*
- * See if the user is accepting messages. If so, announce that
- * a talk is requested.
- */
-int
-announce_proc(request, remote_machine)
- CTL_MSG *request;
- char *remote_machine;
-{
int pid, status;
char full_tty[MAXPATHLEN];
FILE *tf;
@@ -115,12 +77,6 @@ announce_proc(request, remote_machine)
return (FAILED);
if ((tf = fopen(full_tty, "w")) == NULL)
return (PERMISSION_DENIED);
- /*
- * On first tty open, the server will have
- * it's pgrp set, so disconnect us from the
- * tty before we catch a signal.
- */
- ioctl(fileno(tf), TIOCNOTTY, (struct sgttyb *) 0);
if (fstat(fileno(tf), &stbuf) < 0)
return (PERMISSION_DENIED);
if ((stbuf.st_mode&S_IWGRP) == 0)
@@ -206,5 +162,4 @@ print_mesg(tf, request, remote_machine)
*bptr = '\0';
fprintf(tf, big_buf);
fflush(tf);
- ioctl(fileno(tf), TIOCNOTTY, (struct sgttyb *) 0);
}
diff --git a/libexec/talkd/talkd.h b/libexec/talkd/talkd.h
index 283f21bc01f..d0782f147a2 100644
--- a/libexec/talkd/talkd.h
+++ b/libexec/talkd/talkd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: talkd.h,v 1.2 1996/07/15 05:10:12 mickey Exp $ */
+/* $OpenBSD: talkd.h,v 1.3 1998/08/18 03:42:11 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -52,7 +52,6 @@ int find_user __P((char *name, char *tty));
/* announce.c */
int announce __P((CTL_MSG *,char *));
-int announce_proc __P((CTL_MSG *,char *));
/* print.c */
void print_request __P((char *,register CTL_MSG *));