Mercurial > dropbear
comparison scp.c @ 1272:bdc28287f077
explicitly initialization of static variables
author | Francois Perrad <francois.perrad@gadz.org> |
---|---|
date | Fri, 01 Jan 2016 09:15:41 +0100 |
parents | 81ae6ed4e2f4 |
children | 07ee7736397e |
comparison
equal
deleted
inserted
replaced
1271:26622eee1e8b | 1272:bdc28287f077 |
---|---|
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); |
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; |