Deleted Added
full compact
talkd.c (80248) talkd.c (90261)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
43#endif
44static const char rcsid[] =
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
43#endif
44static const char rcsid[] =
45 "$FreeBSD: head/libexec/talkd/talkd.c 80248 2001-07-24 05:41:13Z kris $";
45 "$FreeBSD: head/libexec/talkd/talkd.c 90261 2002-02-05 21:06:56Z imp $";
46#endif /* not lint */
47
48/*
49 * The top level of the daemon, the format is heavily borrowed
50 * from rwhod.c. Basically: find out who and where you are;
51 * disconnect all descriptors and ttys, and then endless
52 * loop on waiting for and processing requests
53 */

--- 7 unchanged lines hidden (view full) ---

61#include <signal.h>
62#include <stdio.h>
63#include <stdlib.h>
64#include <string.h>
65#include <syslog.h>
66#include <time.h>
67#include <unistd.h>
68
46#endif /* not lint */
47
48/*
49 * The top level of the daemon, the format is heavily borrowed
50 * from rwhod.c. Basically: find out who and where you are;
51 * disconnect all descriptors and ttys, and then endless
52 * loop on waiting for and processing requests
53 */

--- 7 unchanged lines hidden (view full) ---

61#include <signal.h>
62#include <stdio.h>
63#include <stdlib.h>
64#include <string.h>
65#include <syslog.h>
66#include <time.h>
67#include <unistd.h>
68
69#include "extern.h"
70
69CTL_MSG request;
70CTL_RESPONSE response;
71
72int sockt;
73int debug = 0;
74long lastmsgtime;
75
76char hostname[MAXHOSTNAMELEN];
77
78#define TIMEOUT 30
79#define MAXIDLE 120
80
71CTL_MSG request;
72CTL_RESPONSE response;
73
74int sockt;
75int debug = 0;
76long lastmsgtime;
77
78char hostname[MAXHOSTNAMELEN];
79
80#define TIMEOUT 30
81#define MAXIDLE 120
82
81void process_request __P((CTL_MSG *, CTL_RESPONSE *));
82void timeout();
83
84int
83int
85main(argc, argv)
86 int argc;
87 char *argv[];
84main(int argc, char *argv[])
88{
89 register CTL_MSG *mp = &request;
90 int cc;
91
92#ifdef NOTDEF
93 /*
94 * removed so ntalkd can run in tty sandbox
95 */

--- 29 unchanged lines hidden (view full) ---

125 sizeof (response), 0, (struct sockaddr *)&mp->ctl_addr,
126 sizeof (mp->ctl_addr));
127 if (cc != sizeof (response))
128 syslog(LOG_WARNING, "sendto: %m");
129 }
130}
131
132void
85{
86 register CTL_MSG *mp = &request;
87 int cc;
88
89#ifdef NOTDEF
90 /*
91 * removed so ntalkd can run in tty sandbox
92 */

--- 29 unchanged lines hidden (view full) ---

122 sizeof (response), 0, (struct sockaddr *)&mp->ctl_addr,
123 sizeof (mp->ctl_addr));
124 if (cc != sizeof (response))
125 syslog(LOG_WARNING, "sendto: %m");
126 }
127}
128
129void
133timeout()
130timeout(int sig __unused)
134{
135 int save_errno = errno;
136
137 if (time(0) - lastmsgtime >= MAXIDLE)
138 _exit(0);
139 alarm(TIMEOUT);
140 errno = save_errno;
141}
131{
132 int save_errno = errno;
133
134 if (time(0) - lastmsgtime >= MAXIDLE)
135 _exit(0);
136 alarm(TIMEOUT);
137 errno = save_errno;
138}