[scp.c]
     use alarm vs. setitimer for portable; ok markus@
This commit is contained in:
Ben Lindstrom 2001-08-06 22:48:19 +00:00
parent de8fc6fadc
commit 958d9f695b
2 changed files with 11 additions and 16 deletions

View File

@ -144,6 +144,9 @@
- markus@cvs.openbsd.org 2001/08/05 23:29:58
[ssh-keyscan.c]
make -t dsa work with commercial servers, too
- stevesk@cvs.openbsd.org 2001/08/06 19:47:05
[scp.c]
use alarm vs. setitimer for portable; ok markus@
20010803
- (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on
@ -6254,4 +6257,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.1464 2001/08/06 22:43:50 mouring Exp $
$Id: ChangeLog,v 1.1465 2001/08/06 22:48:19 mouring Exp $

22
scp.c
View File

@ -75,7 +75,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: scp.c,v 1.78 2001/07/27 17:26:16 deraadt Exp $");
RCSID("$OpenBSD: scp.c,v 1.79 2001/08/06 19:47:05 stevesk Exp $");
#include "xmalloc.h"
#include "atomicio.h"
@ -91,6 +91,8 @@ char *__progname;
/* For progressmeter() -- number of seconds before xfer considered "stalled" */
#define STALLTIME 5
/* alarm() interval for updating progress meter */
#define PROGRESSTIME 1
/* Progress meter bar */
#define BAR \
@ -1064,24 +1066,14 @@ lostconn(signo)
exit(1);
}
static void
alarmtimer(int wait)
{
struct itimerval itv;
itv.it_value.tv_sec = wait;
itv.it_value.tv_usec = 0;
itv.it_interval = itv.it_value;
setitimer(ITIMER_REAL, &itv, NULL);
}
static void
updateprogressmeter(int ignore)
{
int save_errno = errno;
progressmeter(0);
signal(SIGALRM, updateprogressmeter);
alarm(PROGRESSTIME);
errno = save_errno;
}
@ -1194,9 +1186,9 @@ progressmeter(int flag)
if (flag == -1) {
mysignal(SIGALRM, updateprogressmeter);
alarmtimer(1);
alarm(PROGRESSTIME);
} else if (flag == 1) {
alarmtimer(0);
alarm(0);
atomicio(write, fileno(stdout), "\n", 1);
statbytes = 0;
}