summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-08-06 22:48:19 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-08-06 22:48:19 +0000
commit958d9f695b78a03645cb9b426855c291355b7091 (patch)
treee70e0eab2c23adee20767109f2ebe3423f6aded9
parentde8fc6fadc2039747482f17bf4d32c505d0f0383 (diff)
- stevesk@cvs.openbsd.org 2001/08/06 19:47:05
[scp.c] use alarm vs. setitimer for portable; ok markus@
-rw-r--r--ChangeLog5
-rw-r--r--scp.c22
2 files changed, 11 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 07a60152..45b74fd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 $
diff --git a/scp.c b/scp.c
index 71fa299d..4708f0ed 100644
--- a/scp.c
+++ b/scp.c
@@ -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;
}