version 1.113.2.2, 2005/03/10 17:15:04 |
version 1.114, 2004/04/01 12:19:57 |
|
|
static void |
static void |
killchild(int signo) |
killchild(int signo) |
{ |
{ |
if (do_cmd_pid > 1) { |
if (do_cmd_pid > 1) |
kill(do_cmd_pid, signo); |
kill(do_cmd_pid, signo); |
waitpid(do_cmd_pid, NULL, 0); |
|
} |
|
|
|
_exit(1); |
_exit(1); |
} |
} |
|
|
{ |
{ |
static struct timeval bwstart, bwend; |
static struct timeval bwstart, bwend; |
static int lamt, thresh = 16384; |
static int lamt, thresh = 16384; |
u_int64_t waitlen; |
u_int64_t wait; |
struct timespec ts, rm; |
struct timespec ts, rm; |
|
|
if (!timerisset(&bwstart)) { |
if (!timerisset(&bwstart)) { |
|
|
return; |
return; |
|
|
lamt *= 8; |
lamt *= 8; |
waitlen = (double)1000000L * lamt / limit_rate; |
wait = (double)1000000L * lamt / limit_rate; |
|
|
bwstart.tv_sec = waitlen / 1000000L; |
bwstart.tv_sec = wait / 1000000L; |
bwstart.tv_usec = waitlen % 1000000L; |
bwstart.tv_usec = wait % 1000000L; |
|
|
if (timercmp(&bwstart, &bwend, >)) { |
if (timercmp(&bwstart, &bwend, >)) { |
timersub(&bwstart, &bwend, &bwend); |
timersub(&bwstart, &bwend, &bwend); |
|
|
|
|
#define atime tv[0] |
#define atime tv[0] |
#define mtime tv[1] |
#define mtime tv[1] |
#define SCREWUP(str) { why = str; goto screwup; } |
#define SCREWUP(str) do { why = str; goto screwup; } while (0) |
|
|
setimes = targisdir = 0; |
setimes = targisdir = 0; |
mask = umask(0); |
mask = umask(0); |
|
|
amt = size - i; |
amt = size - i; |
count += amt; |
count += amt; |
do { |
do { |
j = atomicio(read, remin, cp, amt); |
j = read(remin, cp, amt); |
if (j <= 0) { |
if (j == -1 && (errno == EINTR || |
|
errno == EAGAIN)) { |
|
continue; |
|
} else if (j <= 0) { |
run_err("%s", j ? strerror(errno) : |
run_err("%s", j ? strerror(errno) : |
"dropped connection"); |
"dropped connection"); |
exit(1); |
exit(1); |
|
|
} |
} |
if (pflag) { |
if (pflag) { |
if (exists || omode != mode) |
if (exists || omode != mode) |
if (fchmod(ofd, omode)) { |
if (fchmod(ofd, omode)) |
run_err("%s: set mode: %s", |
run_err("%s: set mode: %s", |
np, strerror(errno)); |
np, strerror(errno)); |
wrerr = DISPLAYED; |
|
} |
|
} else { |
} else { |
if (!exists && omode != mode) |
if (!exists && omode != mode) |
if (fchmod(ofd, omode & ~mask)) { |
if (fchmod(ofd, omode & ~mask)) |
run_err("%s: set mode: %s", |
run_err("%s: set mode: %s", |
np, strerror(errno)); |
np, strerror(errno)); |
wrerr = DISPLAYED; |
|
} |
|
} |
} |
if (close(ofd) == -1) { |
if (close(ofd) == -1) { |
wrerr = YES; |
wrerr = YES; |