Skip to content

Commit

Permalink
2001-10-01 Aaron Schrab <aaron@schrab.com>
Browse files Browse the repository at this point in the history
	* Fish.cc, Http.cc, commands.cc, log.cc: call va_start multiple
	  times when needed, fixes powerpc coredumps.
  • Loading branch information
lav committed Oct 1, 2001
1 parent 6f297af commit ea0be75
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/ChangeLog
@@ -1,3 +1,8 @@
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.

2001-09-12 Alexander V. Lukyanov <lav@yars.free.net>

* ftpclass.cc: sometimes CWD was not sent after reconnection
Expand Down
4 changes: 2 additions & 2 deletions src/Fish.cc
Expand Up @@ -430,12 +430,12 @@ void Fish::Close()
void Fish::Send(const char *format,...)
{
va_list va;
va_start(va,format);
char *str;

static int max_send=256;
for(;;)
{
va_start(va,format);
str=string_alloca(max_send);
int res=vsnprintf(str,max_send,format,va);
if(res>=0 && res<max_send)
Expand All @@ -445,11 +445,11 @@ void Fish::Send(const char *format,...)
break;
}
max_send*=2;
va_end(va);
}

DebugPrint("---> ",str,5);
send_buf->Put(str);
va_end(va);
}

const char *Fish::shell_encode(const char *string)
Expand Down
4 changes: 2 additions & 2 deletions src/Http.cc
Expand Up @@ -249,12 +249,12 @@ void Http::Close()
void Http::Send(const char *format,...)
{
va_list va;
va_start(va,format);
char *str;

static int max_send=256;
for(;;)
{
va_start(va,format);
str=string_alloca(max_send);
int res=vsnprintf(str,max_send,format,va);
if(res>=0 && res<max_send)
Expand All @@ -264,11 +264,11 @@ void Http::Send(const char *format,...)
break;
}
max_send*=2;
va_end(va);
}

DebugPrint("---> ",str,5);
send_buf->Put(str);
va_end(va);
}

void Http::SendMethod(const char *method,const char *efile)
Expand Down
6 changes: 3 additions & 3 deletions src/commands.cc
Expand Up @@ -957,7 +957,7 @@ Job *CmdExec::builtin_queue()
* We want an optional argument, but don't use getopt ::, since
* that'll disallow the space between arguments, which we want. */
arg = args->getarg(args->getindex());

CmdExec *queue=GetQueue(false);
if(!queue) {
eprintf(_("%s: No queue is active.\n"), args->a0());
Expand Down Expand Up @@ -2471,14 +2471,14 @@ CMD(history)
switch(mode) {
case READ:
if(int err = lftp_history_read(fn)) {
eprintf(_("%s: %s: %s\n"), args->a0(), fn, strerror(err));
eprintf("%s: %s: %s\n", args->a0(), fn, strerror(err));
exit_code=1;
}
break;

case WRITE:
if(int err = lftp_history_write(fn)) {
eprintf(_("%s: %s: %s\n"), args->a0(), fn, strerror(err));
eprintf("%s: %s: %s\n", args->a0(), fn, strerror(err));
exit_code=1;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions src/log.cc
Expand Up @@ -74,13 +74,13 @@ void Log::Format(int l,const char *f,...)
static char *buf=0;
static int buf_alloc;
va_list v;
va_start(v,f);

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

for(;;)
{
va_start(v,f);
int res=vsnprintf(buf,buf_alloc,f,v);
if(res>=0 && res<buf_alloc)
break;
Expand All @@ -89,9 +89,9 @@ void Log::Format(int l,const char *f,...)
if(res==-1)
res=buf_alloc*2;
buf=(char*)xrealloc(buf,buf_alloc=res);
va_end(v);
}

va_end(v);
Write(l,buf);
}

Expand Down

0 comments on commit ea0be75

Please sign in to comment.