summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Steves <stevesk@pobox.com>2000-12-15 23:03:10 +0000
committerKevin Steves <stevesk@pobox.com>2000-12-15 23:03:10 +0000
commit7d00ba4d7210a0cde5d758049cdca31cb9b28854 (patch)
treecb53220f3d4f973c3f6bf5a60f9981d5d6e72cf0
parent7aa1d0008a98850eac43b2692bfc93bb1112c2dc (diff)
- deraadt@cvs.openbsd.org 2000/12/11 10:27:33
[scp.c] when copying 0-sized files, do not re-print ETA time at completion
-rw-r--r--ChangeLog3
-rw-r--r--scp.c45
2 files changed, 25 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index a09e11f5a..b62d32e47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,9 @@
24 rhosts-rsa is no longer automagically disabled if ssh is not privileged. 24 rhosts-rsa is no longer automagically disabled if ssh is not privileged.
25 UsePrivilegedPort=no disables rhosts-rsa _only_ for old servers. 25 UsePrivilegedPort=no disables rhosts-rsa _only_ for old servers.
26 these changes should not change the visible default behaviour of the ssh client. 26 these changes should not change the visible default behaviour of the ssh client.
27 - deraadt@cvs.openbsd.org 2000/12/11 10:27:33
28 [scp.c]
29 when copying 0-sized files, do not re-print ETA time at completion
27 30
2820001213 3120001213
29 - (djm) Make sure we reset the SIGPIPE disposition after we fork. Report 32 - (djm) Make sure we reset the SIGPIPE disposition after we fork. Report
diff --git a/scp.c b/scp.c
index 9af5c54dd..1f8de3881 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.43 2000/10/18 18:23:02 markus Exp $"); 78RCSID("$OpenBSD: scp.c,v 1.44 2000/12/11 17:27:33 deraadt Exp $");
79 79
80#include "ssh.h" 80#include "ssh.h"
81#include "xmalloc.h" 81#include "xmalloc.h"
@@ -415,20 +415,20 @@ toremote(targ, argc, argv)
415 suser = pwd->pw_name; 415 suser = pwd->pw_name;
416 else if (!okname(suser)) 416 else if (!okname(suser))
417 continue; 417 continue;
418 (void) sprintf(bp, 418 sprintf(bp,
419 "%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'", 419 "%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'",
420 ssh_program, verbose_mode ? " -v" : "", 420 ssh_program, verbose_mode ? " -v" : "",
421 suser, host, cmd, src, 421 suser, host, cmd, src,
422 tuser ? tuser : "", tuser ? "@" : "", 422 tuser ? tuser : "", tuser ? "@" : "",
423 thost, targ); 423 thost, targ);
424 } else { 424 } else {
425 host = cleanhostname(argv[i]); 425 host = cleanhostname(argv[i]);
426 (void) sprintf(bp, 426 sprintf(bp,
427 "exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'", 427 "exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'",
428 ssh_program, verbose_mode ? " -v" : "", 428 ssh_program, verbose_mode ? " -v" : "",
429 host, cmd, src, 429 host, cmd, src,
430 tuser ? tuser : "", tuser ? "@" : "", 430 tuser ? tuser : "", tuser ? "@" : "",
431 thost, targ); 431 thost, targ);
432 } 432 }
433 if (verbose_mode) 433 if (verbose_mode)
434 fprintf(stderr, "Executing: %s\n", bp); 434 fprintf(stderr, "Executing: %s\n", bp);
@@ -557,10 +557,9 @@ syserr: run_err("%s: %s", name, strerror(errno));
557 goto next; 557 goto next;
558 } 558 }
559#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO) 559#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
560 (void) sprintf(buf, "C%04o %lu %s\n", 560 sprintf(buf, "C%04o %lu %s\n",
561 (unsigned int) (stb.st_mode & FILEMODEMASK), 561 (unsigned int) (stb.st_mode & FILEMODEMASK),
562 (unsigned long) stb.st_size, 562 (unsigned long) stb.st_size, last);
563 last);
564 if (verbose_mode) { 563 if (verbose_mode) {
565 fprintf(stderr, "Sending file modes: %s", buf); 564 fprintf(stderr, "Sending file modes: %s", buf);
566 fflush(stderr); 565 fflush(stderr);
@@ -715,7 +714,7 @@ sink(argc, argv)
715 if (buf[0] == '\01' || buf[0] == '\02') { 714 if (buf[0] == '\01' || buf[0] == '\02') {
716 if (iamremote == 0) 715 if (iamremote == 0)
717 (void) atomicio(write, STDERR_FILENO, 716 (void) atomicio(write, STDERR_FILENO,
718 buf + 1, strlen(buf + 1)); 717 buf + 1, strlen(buf + 1));
719 if (buf[0] == '\02') 718 if (buf[0] == '\02')
720 exit(1); 719 exit(1);
721 ++errs; 720 ++errs;
@@ -1187,8 +1186,7 @@ progressmeter(int flag)
1187 abbrevsize >>= 10; 1186 abbrevsize >>= 10;
1188 } 1187 }
1189 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %5d %c%c ", 1188 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %5d %c%c ",
1190 (int) abbrevsize, prefixes[i], prefixes[i] == ' ' ? ' ' : 1189 (int) abbrevsize, prefixes[i], prefixes[i] == ' ' ? ' ' : 'B');
1191 'B');
1192 1190
1193 timersub(&now, &lastupdate, &wait); 1191 timersub(&now, &lastupdate, &wait);
1194 if (cursize > lastsize) { 1192 if (cursize > lastsize) {
@@ -1203,16 +1201,17 @@ progressmeter(int flag)
1203 timersub(&now, &start, &td); 1201 timersub(&now, &start, &td);
1204 elapsed = td.tv_sec + (td.tv_usec / 1000000.0); 1202 elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
1205 1203
1206 if (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes) { 1204 if (flag != 1 &&
1205 (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes)) {
1207 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), 1206 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
1208 " --:-- ETA"); 1207 " --:-- ETA");
1209 } else if (wait.tv_sec >= STALLTIME) { 1208 } else if (wait.tv_sec >= STALLTIME) {
1210 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), 1209 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
1211 " - stalled -"); 1210 " - stalled -");
1212 } else { 1211 } else {
1213 if (flag != 1) 1212 if (flag != 1)
1214 remaining = 1213 remaining = (int)(totalbytes / (statbytes / elapsed) -
1215 (int)(totalbytes / (statbytes / elapsed) - elapsed); 1214 elapsed);
1216 else 1215 else
1217 remaining = elapsed; 1216 remaining = elapsed;
1218 1217