Skip to content

Commit ea0be75

Browse files
author
lav
committed
2001-10-01 Aaron Schrab <aaron@schrab.com>
* Fish.cc, Http.cc, commands.cc, log.cc: call va_start multiple times when needed, fixes powerpc coredumps.
1 parent 6f297af commit ea0be75

5 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2001-10-01 Aaron Schrab <aaron@schrab.com>
2+
3+
* Fish.cc, Http.cc, commands.cc, log.cc: call va_start multiple
4+
times when needed, fixes powerpc coredumps.
5+
16
2001-09-12 Alexander V. Lukyanov <lav@yars.free.net>
27

38
* ftpclass.cc: sometimes CWD was not sent after reconnection

src/Fish.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,12 @@ void Fish::Close()
430430
void Fish::Send(const char *format,...)
431431
{
432432
va_list va;
433-
va_start(va,format);
434433
char *str;
435434

436435
static int max_send=256;
437436
for(;;)
438437
{
438+
va_start(va,format);
439439
str=string_alloca(max_send);
440440
int res=vsnprintf(str,max_send,format,va);
441441
if(res>=0 && res<max_send)
@@ -445,11 +445,11 @@ void Fish::Send(const char *format,...)
445445
break;
446446
}
447447
max_send*=2;
448+
va_end(va);
448449
}
449450

450451
DebugPrint("---> ",str,5);
451452
send_buf->Put(str);
452-
va_end(va);
453453
}
454454

455455
const char *Fish::shell_encode(const char *string)

src/Http.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,12 @@ void Http::Close()
249249
void Http::Send(const char *format,...)
250250
{
251251
va_list va;
252-
va_start(va,format);
253252
char *str;
254253

255254
static int max_send=256;
256255
for(;;)
257256
{
257+
va_start(va,format);
258258
str=string_alloca(max_send);
259259
int res=vsnprintf(str,max_send,format,va);
260260
if(res>=0 && res<max_send)
@@ -264,11 +264,11 @@ void Http::Send(const char *format,...)
264264
break;
265265
}
266266
max_send*=2;
267+
va_end(va);
267268
}
268269

269270
DebugPrint("---> ",str,5);
270271
send_buf->Put(str);
271-
va_end(va);
272272
}
273273

274274
void Http::SendMethod(const char *method,const char *efile)

src/commands.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ Job *CmdExec::builtin_queue()
957957
* We want an optional argument, but don't use getopt ::, since
958958
* that'll disallow the space between arguments, which we want. */
959959
arg = args->getarg(args->getindex());
960-
960+
961961
CmdExec *queue=GetQueue(false);
962962
if(!queue) {
963963
eprintf(_("%s: No queue is active.\n"), args->a0());
@@ -2471,14 +2471,14 @@ CMD(history)
24712471
switch(mode) {
24722472
case READ:
24732473
if(int err = lftp_history_read(fn)) {
2474-
eprintf(_("%s: %s: %s\n"), args->a0(), fn, strerror(err));
2474+
eprintf("%s: %s: %s\n", args->a0(), fn, strerror(err));
24752475
exit_code=1;
24762476
}
24772477
break;
24782478

24792479
case WRITE:
24802480
if(int err = lftp_history_write(fn)) {
2481-
eprintf(_("%s: %s: %s\n"), args->a0(), fn, strerror(err));
2481+
eprintf("%s: %s: %s\n", args->a0(), fn, strerror(err));
24822482
exit_code=1;
24832483
}
24842484
break;

src/log.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ void Log::Format(int l,const char *f,...)
7474
static char *buf=0;
7575
static int buf_alloc;
7676
va_list v;
77-
va_start(v,f);
7877

7978
if(buf==0)
8079
buf=(char*)xmalloc(buf_alloc=1024);
8180

8281
for(;;)
8382
{
83+
va_start(v,f);
8484
int res=vsnprintf(buf,buf_alloc,f,v);
8585
if(res>=0 && res<buf_alloc)
8686
break;
@@ -89,9 +89,9 @@ void Log::Format(int l,const char *f,...)
8989
if(res==-1)
9090
res=buf_alloc*2;
9191
buf=(char*)xrealloc(buf,buf_alloc=res);
92+
va_end(v);
9293
}
9394

94-
va_end(v);
9595
Write(l,buf);
9696
}
9797

0 commit comments

Comments
 (0)