Mercurial > dropbear
comparison scp.c @ 1278:0c47d97aa9d5
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 16 Mar 2016 22:53:27 +0800 |
parents | 07ee7736397e |
children | 750ec4ec4cbe |
comparison
equal
deleted
inserted
replaced
1264:a20b6af6f182 | 1278:0c47d97aa9d5 |
---|---|
670 (void) close(fd); | 670 (void) close(fd); |
671 fd = -1; | 671 fd = -1; |
672 } | 672 } |
673 continue; | 673 continue; |
674 } | 674 } |
675 #if PROGRESS_METER | 675 #ifdef PROGRESS_METER |
676 if (showprogress) | 676 if (showprogress) |
677 start_progress_meter(curfile, stb.st_size, &statbytes); | 677 start_progress_meter(curfile, stb.st_size, &statbytes); |
678 #endif | 678 #endif |
679 /* Keep writing after an error so that we stay sync'd up. */ | 679 /* Keep writing after an error so that we stay sync'd up. */ |
680 for (haderr = i = 0; i < stb.st_size; i += bp->cnt) { | 680 for (haderr = i = 0; i < stb.st_size; i += bp->cnt) { |
770 | 770 |
771 void | 771 void |
772 bwlimit(int amount) | 772 bwlimit(int amount) |
773 { | 773 { |
774 static struct timeval bwstart, bwend; | 774 static struct timeval bwstart, bwend; |
775 static int lamt, thresh = 16384; | 775 static int lamt = 0, thresh = 16384; |
776 uint64_t waitlen; | 776 uint64_t waitlen; |
777 struct timespec ts, rm; | 777 struct timespec ts, rm; |
778 | 778 |
779 if (!timerisset(&bwstart)) { | 779 if (!timerisset(&bwstart)) { |
780 gettimeofday(&bwstart, NULL); | 780 gettimeofday(&bwstart, NULL); |
839 char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; | 839 char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; |
840 struct timeval tv[2]; | 840 struct timeval tv[2]; |
841 | 841 |
842 #define atime tv[0] | 842 #define atime tv[0] |
843 #define mtime tv[1] | 843 #define mtime tv[1] |
844 #define SCREWUP(str) { why = str; goto screwup; } | 844 #define SCREWUP(str) do { why = str; goto screwup; } while (0) |
845 | 845 |
846 setimes = targisdir = 0; | 846 setimes = targisdir = 0; |
847 mask = umask(0); | 847 mask = umask(0); |
848 if (!pflag) | 848 if (!pflag) |
849 (void) umask(mask); | 849 (void) umask(mask); |
938 if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) { | 938 if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) { |
939 run_err("error: unexpected filename: %s", cp); | 939 run_err("error: unexpected filename: %s", cp); |
940 exit(1); | 940 exit(1); |
941 } | 941 } |
942 if (targisdir) { | 942 if (targisdir) { |
943 static char *namebuf; | 943 static char *namebuf = NULL; |
944 static size_t cursize; | 944 static size_t cursize = 0; |
945 size_t need; | 945 size_t need; |
946 | 946 |
947 need = strlen(targ) + strlen(cp) + 250; | 947 need = strlen(targ) + strlen(cp) + 250; |
948 if (need > cursize) { | 948 if (need > cursize) { |
949 if (namebuf) | 949 if (namebuf) |
1151 } | 1151 } |
1152 | 1152 |
1153 void | 1153 void |
1154 run_err(const char *fmt,...) | 1154 run_err(const char *fmt,...) |
1155 { | 1155 { |
1156 static FILE *fp; | 1156 static FILE *fp = NULL; |
1157 va_list ap; | 1157 va_list ap; |
1158 | 1158 |
1159 ++errs; | 1159 ++errs; |
1160 if (fp == NULL && !(fp = fdopen(remout, "w"))) | 1160 if (fp == NULL && !(fp = fdopen(remout, "w"))) |
1161 return; | 1161 return; |