- 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
This commit is contained in:
parent
7aa1d0008a
commit
7d00ba4d72
|
@ -24,6 +24,9 @@
|
||||||
rhosts-rsa is no longer automagically disabled if ssh is not privileged.
|
rhosts-rsa is no longer automagically disabled if ssh is not privileged.
|
||||||
UsePrivilegedPort=no disables rhosts-rsa _only_ for old servers.
|
UsePrivilegedPort=no disables rhosts-rsa _only_ for old servers.
|
||||||
these changes should not change the visible default behaviour of the ssh client.
|
these changes should not change the visible default behaviour of the ssh client.
|
||||||
|
- 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
|
||||||
|
|
||||||
20001213
|
20001213
|
||||||
- (djm) Make sure we reset the SIGPIPE disposition after we fork. Report
|
- (djm) Make sure we reset the SIGPIPE disposition after we fork. Report
|
||||||
|
|
45
scp.c
45
scp.c
|
@ -75,7 +75,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: scp.c,v 1.43 2000/10/18 18:23:02 markus Exp $");
|
RCSID("$OpenBSD: scp.c,v 1.44 2000/12/11 17:27:33 deraadt Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
@ -415,20 +415,20 @@ toremote(targ, argc, argv)
|
||||||
suser = pwd->pw_name;
|
suser = pwd->pw_name;
|
||||||
else if (!okname(suser))
|
else if (!okname(suser))
|
||||||
continue;
|
continue;
|
||||||
(void) sprintf(bp,
|
sprintf(bp,
|
||||||
"%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'",
|
"%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'",
|
||||||
ssh_program, verbose_mode ? " -v" : "",
|
ssh_program, verbose_mode ? " -v" : "",
|
||||||
suser, host, cmd, src,
|
suser, host, cmd, src,
|
||||||
tuser ? tuser : "", tuser ? "@" : "",
|
tuser ? tuser : "", tuser ? "@" : "",
|
||||||
thost, targ);
|
thost, targ);
|
||||||
} else {
|
} else {
|
||||||
host = cleanhostname(argv[i]);
|
host = cleanhostname(argv[i]);
|
||||||
(void) sprintf(bp,
|
sprintf(bp,
|
||||||
"exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'",
|
"exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'",
|
||||||
ssh_program, verbose_mode ? " -v" : "",
|
ssh_program, verbose_mode ? " -v" : "",
|
||||||
host, cmd, src,
|
host, cmd, src,
|
||||||
tuser ? tuser : "", tuser ? "@" : "",
|
tuser ? tuser : "", tuser ? "@" : "",
|
||||||
thost, targ);
|
thost, targ);
|
||||||
}
|
}
|
||||||
if (verbose_mode)
|
if (verbose_mode)
|
||||||
fprintf(stderr, "Executing: %s\n", bp);
|
fprintf(stderr, "Executing: %s\n", bp);
|
||||||
|
@ -557,10 +557,9 @@ syserr: run_err("%s: %s", name, strerror(errno));
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
|
#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
|
||||||
(void) sprintf(buf, "C%04o %lu %s\n",
|
sprintf(buf, "C%04o %lu %s\n",
|
||||||
(unsigned int) (stb.st_mode & FILEMODEMASK),
|
(unsigned int) (stb.st_mode & FILEMODEMASK),
|
||||||
(unsigned long) stb.st_size,
|
(unsigned long) stb.st_size, last);
|
||||||
last);
|
|
||||||
if (verbose_mode) {
|
if (verbose_mode) {
|
||||||
fprintf(stderr, "Sending file modes: %s", buf);
|
fprintf(stderr, "Sending file modes: %s", buf);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
@ -715,7 +714,7 @@ sink(argc, argv)
|
||||||
if (buf[0] == '\01' || buf[0] == '\02') {
|
if (buf[0] == '\01' || buf[0] == '\02') {
|
||||||
if (iamremote == 0)
|
if (iamremote == 0)
|
||||||
(void) atomicio(write, STDERR_FILENO,
|
(void) atomicio(write, STDERR_FILENO,
|
||||||
buf + 1, strlen(buf + 1));
|
buf + 1, strlen(buf + 1));
|
||||||
if (buf[0] == '\02')
|
if (buf[0] == '\02')
|
||||||
exit(1);
|
exit(1);
|
||||||
++errs;
|
++errs;
|
||||||
|
@ -1187,8 +1186,7 @@ progressmeter(int flag)
|
||||||
abbrevsize >>= 10;
|
abbrevsize >>= 10;
|
||||||
}
|
}
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %5d %c%c ",
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %5d %c%c ",
|
||||||
(int) abbrevsize, prefixes[i], prefixes[i] == ' ' ? ' ' :
|
(int) abbrevsize, prefixes[i], prefixes[i] == ' ' ? ' ' : 'B');
|
||||||
'B');
|
|
||||||
|
|
||||||
timersub(&now, &lastupdate, &wait);
|
timersub(&now, &lastupdate, &wait);
|
||||||
if (cursize > lastsize) {
|
if (cursize > lastsize) {
|
||||||
|
@ -1203,16 +1201,17 @@ progressmeter(int flag)
|
||||||
timersub(&now, &start, &td);
|
timersub(&now, &start, &td);
|
||||||
elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
|
elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
|
||||||
|
|
||||||
if (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes) {
|
if (flag != 1 &&
|
||||||
|
(statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes)) {
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
||||||
" --:-- ETA");
|
" --:-- ETA");
|
||||||
} else if (wait.tv_sec >= STALLTIME) {
|
} else if (wait.tv_sec >= STALLTIME) {
|
||||||
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
|
||||||
" - stalled -");
|
" - stalled -");
|
||||||
} else {
|
} else {
|
||||||
if (flag != 1)
|
if (flag != 1)
|
||||||
remaining =
|
remaining = (int)(totalbytes / (statbytes / elapsed) -
|
||||||
(int)(totalbytes / (statbytes / elapsed) - elapsed);
|
elapsed);
|
||||||
else
|
else
|
||||||
remaining = elapsed;
|
remaining = elapsed;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue