rename the arm() func to arm_timer() as gcc arm compilers define "arm" by default
This commit is contained in:
parent
5d9df913c4
commit
e670149ab9
18
netcat.c
18
netcat.c
|
@ -247,9 +247,9 @@ void tmtravel ()
|
||||||
longjmp (jbuf, jval);
|
longjmp (jbuf, jval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* arm :
|
/* arm_timer :
|
||||||
set the timer. Zero secs arg means unarm */
|
set the timer. Zero secs arg means unarm */
|
||||||
void arm (num, secs)
|
void arm_timer (num, secs)
|
||||||
unsigned int num;
|
unsigned int num;
|
||||||
unsigned int secs;
|
unsigned int secs;
|
||||||
{
|
{
|
||||||
|
@ -262,7 +262,7 @@ void arm (num, secs)
|
||||||
alarm (secs);
|
alarm (secs);
|
||||||
jval = num;
|
jval = num;
|
||||||
} /* if secs */
|
} /* if secs */
|
||||||
} /* arm */
|
} /* arm_timer */
|
||||||
|
|
||||||
/* Hmalloc :
|
/* Hmalloc :
|
||||||
malloc up what I want, rounded up to *4, and pre-zeroed. Either succeeds
|
malloc up what I want, rounded up to *4, and pre-zeroed. Either succeeds
|
||||||
|
@ -755,14 +755,14 @@ Linux is also still a loss at 1.3.x it looks like; the lsrr code is { }...
|
||||||
} /* if gatesidx */
|
} /* if gatesidx */
|
||||||
|
|
||||||
/* wrap connect inside a timer, and hit it */
|
/* wrap connect inside a timer, and hit it */
|
||||||
arm (1, o_wait);
|
arm_timer (1, o_wait);
|
||||||
if (setjmp (jbuf) == 0) {
|
if (setjmp (jbuf) == 0) {
|
||||||
rr = connect (nnetfd, (SA *)remend, sizeof (SA));
|
rr = connect (nnetfd, (SA *)remend, sizeof (SA));
|
||||||
} else { /* setjmp: connect failed... */
|
} else { /* setjmp: connect failed... */
|
||||||
rr = -1;
|
rr = -1;
|
||||||
errno = ETIMEDOUT; /* fake it */
|
errno = ETIMEDOUT; /* fake it */
|
||||||
}
|
}
|
||||||
arm (0, 0);
|
arm_timer (0, 0);
|
||||||
if (rr == 0)
|
if (rr == 0)
|
||||||
return (nnetfd);
|
return (nnetfd);
|
||||||
close (nnetfd); /* clean up junked socket FD!! */
|
close (nnetfd); /* clean up junked socket FD!! */
|
||||||
|
@ -832,14 +832,14 @@ int dolisten (rad, rp, lad, lp)
|
||||||
actually does work after all. Yow. YMMV on strange platforms! */
|
actually does work after all. Yow. YMMV on strange platforms! */
|
||||||
if (o_udpmode) {
|
if (o_udpmode) {
|
||||||
x = sizeof (SA); /* retval for recvfrom */
|
x = sizeof (SA); /* retval for recvfrom */
|
||||||
arm (2, o_wait); /* might as well timeout this, too */
|
arm_timer (2, o_wait); /* might as well timeout this, too */
|
||||||
if (setjmp (jbuf) == 0) { /* do timeout for initial connect */
|
if (setjmp (jbuf) == 0) { /* do timeout for initial connect */
|
||||||
rr = recvfrom /* and here we block... */
|
rr = recvfrom /* and here we block... */
|
||||||
(nnetfd, bigbuf_net, BIGSIZ, MSG_PEEK, (SA *) remend, &x);
|
(nnetfd, bigbuf_net, BIGSIZ, MSG_PEEK, (SA *) remend, &x);
|
||||||
Debug (("dolisten/recvfrom ding, rr = %d, netbuf %s ", rr, bigbuf_net))
|
Debug (("dolisten/recvfrom ding, rr = %d, netbuf %s ", rr, bigbuf_net))
|
||||||
} else
|
} else
|
||||||
goto dol_tmo; /* timeout */
|
goto dol_tmo; /* timeout */
|
||||||
arm (0, 0);
|
arm_timer (0, 0);
|
||||||
/* I'm not completely clear on how this works -- BSD seems to make UDP
|
/* I'm not completely clear on how this works -- BSD seems to make UDP
|
||||||
just magically work in a connect()ed context, but we'll undoubtedly run
|
just magically work in a connect()ed context, but we'll undoubtedly run
|
||||||
into systems this deal doesn't work on. For now, we apparently have to
|
into systems this deal doesn't work on. For now, we apparently have to
|
||||||
|
@ -857,12 +857,12 @@ Debug (("dolisten/recvfrom ding, rr = %d, netbuf %s ", rr, bigbuf_net))
|
||||||
|
|
||||||
/* fall here for TCP */
|
/* fall here for TCP */
|
||||||
x = sizeof (SA); /* retval for accept */
|
x = sizeof (SA); /* retval for accept */
|
||||||
arm (2, o_wait); /* wrap this in a timer, too; 0 = forever */
|
arm_timer (2, o_wait); /* wrap this in a timer, too; 0 = forever */
|
||||||
if (setjmp (jbuf) == 0) {
|
if (setjmp (jbuf) == 0) {
|
||||||
rr = accept (nnetfd, (SA *)remend, &x);
|
rr = accept (nnetfd, (SA *)remend, &x);
|
||||||
} else
|
} else
|
||||||
goto dol_tmo; /* timeout */
|
goto dol_tmo; /* timeout */
|
||||||
arm (0, 0);
|
arm_timer (0, 0);
|
||||||
close (nnetfd); /* dump the old socket */
|
close (nnetfd); /* dump the old socket */
|
||||||
nnetfd = rr; /* here's our new one */
|
nnetfd = rr; /* here's our new one */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue