Use err(3). Add protos for -Wall.
This commit is contained in:
parent
a40772799f
commit
a846453c5e
@ -29,12 +29,14 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)announce.c 8.3 (Berkeley) 4/28/95";
|
static char sccsid[] = "@(#)announce.c 8.3 (Berkeley) 4/28/95";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -57,6 +59,9 @@ static char sccsid[] = "@(#)announce.c 8.3 (Berkeley) 4/28/95";
|
|||||||
|
|
||||||
extern char hostname[];
|
extern char hostname[];
|
||||||
|
|
||||||
|
int print_mesg __P((char *, FILE *, CTL_MSG *, char *));
|
||||||
|
char *ttymsg __P((struct iovec *, int, char *, int));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Announce an invitation to talk.
|
* Announce an invitation to talk.
|
||||||
*/
|
*/
|
||||||
@ -65,6 +70,7 @@ extern char hostname[];
|
|||||||
* See if the user is accepting messages. If so, announce that
|
* See if the user is accepting messages. If so, announce that
|
||||||
* a talk is requested.
|
* a talk is requested.
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
announce(request, remote_machine)
|
announce(request, remote_machine)
|
||||||
CTL_MSG *request;
|
CTL_MSG *request;
|
||||||
char *remote_machine;
|
char *remote_machine;
|
||||||
@ -90,6 +96,7 @@ announce(request, remote_machine)
|
|||||||
* try to keep the message in one piece if the recipient
|
* try to keep the message in one piece if the recipient
|
||||||
* in in vi at the time
|
* in in vi at the time
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
print_mesg(tty, tf, request, remote_machine)
|
print_mesg(tty, tf, request, remote_machine)
|
||||||
char *tty;
|
char *tty;
|
||||||
FILE *tf;
|
FILE *tf;
|
||||||
|
@ -29,12 +29,14 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/4/93";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/* debug print routines */
|
/* debug print routines */
|
||||||
@ -42,8 +44,8 @@ static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/4/93";
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <protocols/talkd.h>
|
#include <protocols/talkd.h>
|
||||||
#include <syslog.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
|
||||||
static char *types[] =
|
static char *types[] =
|
||||||
{ "leave_invite", "look_up", "delete", "announce" };
|
{ "leave_invite", "look_up", "delete", "announce" };
|
||||||
@ -53,6 +55,7 @@ static char *answers[] =
|
|||||||
"unknown_request", "badversion", "badaddr", "badctladdr" };
|
"unknown_request", "badversion", "badaddr", "badctladdr" };
|
||||||
#define NANSWERS (sizeof (answers) / sizeof (answers[0]))
|
#define NANSWERS (sizeof (answers) / sizeof (answers[0]))
|
||||||
|
|
||||||
|
void
|
||||||
print_request(cp, mp)
|
print_request(cp, mp)
|
||||||
char *cp;
|
char *cp;
|
||||||
register CTL_MSG *mp;
|
register CTL_MSG *mp;
|
||||||
@ -68,6 +71,7 @@ print_request(cp, mp)
|
|||||||
cp, tp, mp->id_num, mp->l_name, mp->r_name, mp->r_tty);
|
cp, tp, mp->id_num, mp->l_name, mp->r_name, mp->r_tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
print_response(cp, rp)
|
print_response(cp, rp)
|
||||||
char *cp;
|
char *cp;
|
||||||
register CTL_RESPONSE *rp;
|
register CTL_RESPONSE *rp;
|
||||||
|
@ -29,12 +29,14 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)process.c 8.2 (Berkeley) 11/16/93";
|
static char sccsid[] = "@(#)process.c 8.2 (Berkeley) 11/16/93";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -50,16 +52,26 @@ static char sccsid[] = "@(#)process.c 8.2 (Berkeley) 11/16/93";
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <protocols/talkd.h>
|
#include <protocols/talkd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <syslog.h>
|
#include <paths.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <syslog.h>
|
||||||
#include <paths.h>
|
|
||||||
|
|
||||||
|
int announce __P((CTL_MSG *, char *));
|
||||||
|
int delete_invite __P((int));
|
||||||
|
void do_announce __P((CTL_MSG *, CTL_RESPONSE *));
|
||||||
CTL_MSG *find_request();
|
CTL_MSG *find_request();
|
||||||
CTL_MSG *find_match();
|
CTL_MSG *find_match();
|
||||||
|
int find_user __P((char *, char *));
|
||||||
|
void insert_table __P((CTL_MSG *, CTL_RESPONSE *));
|
||||||
|
int new_id __P((void));
|
||||||
|
void print_request __P((char *, CTL_MSG *));
|
||||||
|
void print_response __P((char *, CTL_RESPONSE *));
|
||||||
|
|
||||||
|
void
|
||||||
process_request(mp, rp)
|
process_request(mp, rp)
|
||||||
register CTL_MSG *mp;
|
register CTL_MSG *mp;
|
||||||
register CTL_RESPONSE *rp;
|
register CTL_RESPONSE *rp;
|
||||||
@ -72,28 +84,28 @@ process_request(mp, rp)
|
|||||||
rp->type = mp->type;
|
rp->type = mp->type;
|
||||||
rp->id_num = htonl(0);
|
rp->id_num = htonl(0);
|
||||||
if (mp->vers != TALK_VERSION) {
|
if (mp->vers != TALK_VERSION) {
|
||||||
syslog(LOG_WARNING, "Bad protocol version %d", mp->vers);
|
syslog(LOG_WARNING, "bad protocol version %d", mp->vers);
|
||||||
rp->answer = BADVERSION;
|
rp->answer = BADVERSION;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mp->id_num = ntohl(mp->id_num);
|
mp->id_num = ntohl(mp->id_num);
|
||||||
mp->addr.sa_family = ntohs(mp->addr.sa_family);
|
mp->addr.sa_family = ntohs(mp->addr.sa_family);
|
||||||
if (mp->addr.sa_family != AF_INET) {
|
if (mp->addr.sa_family != AF_INET) {
|
||||||
syslog(LOG_WARNING, "Bad address, family %d",
|
syslog(LOG_WARNING, "bad address, family %d",
|
||||||
mp->addr.sa_family);
|
mp->addr.sa_family);
|
||||||
rp->answer = BADADDR;
|
rp->answer = BADADDR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mp->ctl_addr.sa_family = ntohs(mp->ctl_addr.sa_family);
|
mp->ctl_addr.sa_family = ntohs(mp->ctl_addr.sa_family);
|
||||||
if (mp->ctl_addr.sa_family != AF_INET) {
|
if (mp->ctl_addr.sa_family != AF_INET) {
|
||||||
syslog(LOG_WARNING, "Bad control address, family %d",
|
syslog(LOG_WARNING, "bad control address, family %d",
|
||||||
mp->ctl_addr.sa_family);
|
mp->ctl_addr.sa_family);
|
||||||
rp->answer = BADCTLADDR;
|
rp->answer = BADCTLADDR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (s = mp->l_name; *s; s++)
|
for (s = mp->l_name; *s; s++)
|
||||||
if (!isprint(*s)) {
|
if (!isprint(*s)) {
|
||||||
syslog(LOG_NOTICE, "Illegal user name. Aborting");
|
syslog(LOG_NOTICE, "illegal user name. Aborting");
|
||||||
rp->answer = FAILED;
|
rp->answer = FAILED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -138,6 +150,7 @@ process_request(mp, rp)
|
|||||||
print_response("process_request", rp);
|
print_response("process_request", rp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
do_announce(mp, rp)
|
do_announce(mp, rp)
|
||||||
register CTL_MSG *mp;
|
register CTL_MSG *mp;
|
||||||
CTL_RESPONSE *rp;
|
CTL_RESPONSE *rp;
|
||||||
@ -185,6 +198,7 @@ do_announce(mp, rp)
|
|||||||
/*
|
/*
|
||||||
* Search utmp for the local user
|
* Search utmp for the local user
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
find_user(name, tty)
|
find_user(name, tty)
|
||||||
char *name, *tty;
|
char *name, *tty;
|
||||||
{
|
{
|
||||||
@ -197,7 +211,7 @@ find_user(name, tty)
|
|||||||
char ftty[sizeof(_PATH_DEV) - 1 + sizeof(line)];
|
char ftty[sizeof(_PATH_DEV) - 1 + sizeof(line)];
|
||||||
|
|
||||||
if ((fd = fopen(_PATH_UTMP, "r")) == NULL) {
|
if ((fd = fopen(_PATH_UTMP, "r")) == NULL) {
|
||||||
fprintf(stderr, "talkd: can't read %s.\n", _PATH_UTMP);
|
warnx("can't read %s", _PATH_UTMP);
|
||||||
return (FAILED);
|
return (FAILED);
|
||||||
}
|
}
|
||||||
#define SCMPN(a, b) strncmp(a, b, sizeof (a))
|
#define SCMPN(a, b) strncmp(a, b, sizeof (a))
|
||||||
|
@ -29,12 +29,14 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/4/93";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -49,11 +51,11 @@ static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/4/93";
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <protocols/talkd.h>
|
#include <protocols/talkd.h>
|
||||||
#include <syslog.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define MAX_ID 16000 /* << 2^15 so I don't have sign troubles */
|
#define MAX_ID 16000 /* << 2^15 so I don't have sign troubles */
|
||||||
|
|
||||||
@ -73,8 +75,12 @@ struct table_entry {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TABLE_ENTRY *table = NIL;
|
TABLE_ENTRY *table = NIL;
|
||||||
|
|
||||||
|
void delete __P((TABLE_ENTRY *));
|
||||||
CTL_MSG *find_request();
|
CTL_MSG *find_request();
|
||||||
CTL_MSG *find_match();
|
CTL_MSG *find_match();
|
||||||
|
int new_id __P((void));
|
||||||
|
void print_request __P((char *, CTL_MSG *));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Look in the table for an invitation that matches the current
|
* Look in the table for an invitation that matches the current
|
||||||
@ -152,6 +158,7 @@ find_request(request)
|
|||||||
return ((CTL_MSG *)0);
|
return ((CTL_MSG *)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
insert_table(request, response)
|
insert_table(request, response)
|
||||||
CTL_MSG *request;
|
CTL_MSG *request;
|
||||||
CTL_RESPONSE *response;
|
CTL_RESPONSE *response;
|
||||||
@ -181,6 +188,7 @@ insert_table(request, response)
|
|||||||
/*
|
/*
|
||||||
* Generate a unique non-zero sequence number
|
* Generate a unique non-zero sequence number
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
new_id()
|
new_id()
|
||||||
{
|
{
|
||||||
static int current_id = 0;
|
static int current_id = 0;
|
||||||
@ -195,6 +203,7 @@ new_id()
|
|||||||
/*
|
/*
|
||||||
* Delete the invitation with id 'id_num'
|
* Delete the invitation with id 'id_num'
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
delete_invite(id_num)
|
delete_invite(id_num)
|
||||||
int id_num;
|
int id_num;
|
||||||
{
|
{
|
||||||
@ -219,6 +228,7 @@ delete_invite(id_num)
|
|||||||
/*
|
/*
|
||||||
* Classic delete from a double-linked list
|
* Classic delete from a double-linked list
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
delete(ptr)
|
delete(ptr)
|
||||||
register TABLE_ENTRY *ptr;
|
register TABLE_ENTRY *ptr;
|
||||||
{
|
{
|
||||||
|
@ -56,11 +56,13 @@ type
|
|||||||
This causes the server to search its invitation
|
This causes the server to search its invitation
|
||||||
tables to check if an invitation currently exists for the caller
|
tables to check if an invitation currently exists for the caller
|
||||||
(to speak to the callee specified in the message).
|
(to speak to the callee specified in the message).
|
||||||
|
.Pp
|
||||||
If the lookup fails,
|
If the lookup fails,
|
||||||
the caller then sends an
|
the caller then sends an
|
||||||
.Tn ANNOUNCE
|
.Tn ANNOUNCE
|
||||||
message causing the server to
|
message causing the server to
|
||||||
broadcast an announcement on the callee's login ports requesting contact.
|
broadcast an announcement on the callee's login ports requesting contact.
|
||||||
|
.Pp
|
||||||
When the callee responds, the local server uses the
|
When the callee responds, the local server uses the
|
||||||
recorded invitation to respond with the appropriate rendezvous
|
recorded invitation to respond with the appropriate rendezvous
|
||||||
address and the caller and callee client programs establish a
|
address and the caller and callee client programs establish a
|
||||||
|
@ -29,18 +29,20 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static const char copyright[] =
|
||||||
"@(#) Copyright (c) 1983, 1993\n\
|
"@(#) Copyright (c) 1983, 1993\n\
|
||||||
The Regents of the University of California. All rights reserved.\n";
|
The Regents of the University of California. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -53,22 +55,22 @@ static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <protocols/talkd.h>
|
#include <protocols/talkd.h>
|
||||||
#include <signal.h>
|
#include <err.h>
|
||||||
#include <syslog.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <paths.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <paths.h>
|
#include <syslog.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
CTL_MSG request;
|
CTL_MSG request;
|
||||||
CTL_RESPONSE response;
|
CTL_RESPONSE response;
|
||||||
|
|
||||||
int sockt;
|
int sockt;
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
void timeout();
|
|
||||||
long lastmsgtime;
|
long lastmsgtime;
|
||||||
|
|
||||||
char hostname[MAXHOSTNAMELEN + 1];
|
char hostname[MAXHOSTNAMELEN + 1];
|
||||||
@ -76,6 +78,10 @@ char hostname[MAXHOSTNAMELEN + 1];
|
|||||||
#define TIMEOUT 30
|
#define TIMEOUT 30
|
||||||
#define MAXIDLE 120
|
#define MAXIDLE 120
|
||||||
|
|
||||||
|
void process_request __P((CTL_MSG *, CTL_RESPONSE *));
|
||||||
|
void timeout();
|
||||||
|
|
||||||
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
@ -83,10 +89,8 @@ main(argc, argv)
|
|||||||
register CTL_MSG *mp = &request;
|
register CTL_MSG *mp = &request;
|
||||||
int cc;
|
int cc;
|
||||||
|
|
||||||
if (getuid()) {
|
if (getuid())
|
||||||
fprintf(stderr, "%s: getuid: not super-user\n", argv[0]);
|
errx(1, "getuid: not super-user");
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
openlog("talkd", LOG_PID, LOG_DAEMON);
|
openlog("talkd", LOG_PID, LOG_DAEMON);
|
||||||
if (gethostname(hostname, sizeof (hostname) - 1) < 0) {
|
if (gethostname(hostname, sizeof (hostname) - 1) < 0) {
|
||||||
syslog(LOG_ERR, "gethostname: %m");
|
syslog(LOG_ERR, "gethostname: %m");
|
||||||
@ -101,8 +105,6 @@ main(argc, argv)
|
|||||||
signal(SIGALRM, timeout);
|
signal(SIGALRM, timeout);
|
||||||
alarm(TIMEOUT);
|
alarm(TIMEOUT);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
extern int errno;
|
|
||||||
|
|
||||||
cc = recv(0, (char *)mp, sizeof (*mp), 0);
|
cc = recv(0, (char *)mp, sizeof (*mp), 0);
|
||||||
if (cc != sizeof (*mp)) {
|
if (cc != sizeof (*mp)) {
|
||||||
if (cc < 0 && errno != EINTR)
|
if (cc < 0 && errno != EINTR)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user