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 07a601528..45b74fd52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -144,6 +144,9 @@
144 - markus@cvs.openbsd.org 2001/08/05 23:29:58 144 - markus@cvs.openbsd.org 2001/08/05 23:29:58
145 [ssh-keyscan.c] 145 [ssh-keyscan.c]
146 make -t dsa work with commercial servers, too 146 make -t dsa work with commercial servers, too
147 - stevesk@cvs.openbsd.org 2001/08/06 19:47:05
148 [scp.c]
149 use alarm vs. setitimer for portable; ok markus@
147 150
14820010803 15120010803
149 - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on 152 - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on
@@ -6254,4 +6257,4 @@
6254 - Wrote replacements for strlcpy and mkdtemp 6257 - Wrote replacements for strlcpy and mkdtemp
6255 - Released 1.0pre1 6258 - Released 1.0pre1
6256 6259
6257$Id: ChangeLog,v 1.1464 2001/08/06 22:43:50 mouring Exp $ 6260$Id: ChangeLog,v 1.1465 2001/08/06 22:48:19 mouring Exp $
diff --git a/scp.c b/scp.c
index 71fa299db..4708f0ed4 100644
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
75 */ 75 */
76 76
77#include "includes.h" 77#include "includes.h"
78RCSID("$OpenBSD: scp.c,v 1.78 2001/07/27 17:26:16 deraadt Exp $"); 78RCSID("$OpenBSD: scp.c,v 1.79 2001/08/06 19:47:05 stevesk Exp $");
79 79
80#include "xmalloc.h" 80#include "xmalloc.h"
81#include "atomicio.h" 81#include "atomicio.h"
@@ -91,6 +91,8 @@ char *__progname;
91 91
92/* For progressmeter() -- number of seconds before xfer considered "stalled" */ 92/* For progressmeter() -- number of seconds before xfer considered "stalled" */
93#define STALLTIME 5 93#define STALLTIME 5
94/* alarm() interval for updating progress meter */
95#define PROGRESSTIME 1
94 96
95/* Progress meter bar */ 97/* Progress meter bar */
96#define BAR \ 98#define BAR \
@@ -1064,24 +1066,14 @@ lostconn(signo)
1064 exit(1); 1066 exit(1);
1065} 1067}
1066 1068
1067
1068static void
1069alarmtimer(int wait)
1070{
1071 struct itimerval itv;
1072
1073 itv.it_value.tv_sec = wait;
1074 itv.it_value.tv_usec = 0;
1075 itv.it_interval = itv.it_value;
1076 setitimer(ITIMER_REAL, &itv, NULL);
1077}
1078
1079static void 1069static void
1080updateprogressmeter(int ignore) 1070updateprogressmeter(int ignore)
1081{ 1071{
1082 int save_errno = errno; 1072 int save_errno = errno;
1083 1073
1084 progressmeter(0); 1074 progressmeter(0);
1075 signal(SIGALRM, updateprogressmeter);
1076 alarm(PROGRESSTIME);
1085 errno = save_errno; 1077 errno = save_errno;
1086} 1078}
1087 1079
@@ -1194,9 +1186,9 @@ progressmeter(int flag)
1194 1186
1195 if (flag == -1) { 1187 if (flag == -1) {
1196 mysignal(SIGALRM, updateprogressmeter); 1188 mysignal(SIGALRM, updateprogressmeter);
1197 alarmtimer(1); 1189 alarm(PROGRESSTIME);
1198 } else if (flag == 1) { 1190 } else if (flag == 1) {
1199 alarmtimer(0); 1191 alarm(0);
1200 atomicio(write, fileno(stdout), "\n", 1); 1192 atomicio(write, fileno(stdout), "\n", 1);
1201 statbytes = 0; 1193 statbytes = 0;
1202 } 1194 }