mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
fsx was calling vfprintf twice without resetting the va_list argument
Merge of master-melb:xfs-cmds:28212a by kenmcd. fsx was calling vfprintf twice without resetting the va_list argument and this caused a segfault on the second call. Now uses one call to vsnprintf to print to a buffer and uses that multiple times.
This commit is contained in:
@@ -153,16 +153,20 @@ warn(const char * fmt, ...) {
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
|
||||
void
|
||||
prt(char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buffer[BUF_SIZE];
|
||||
|
||||
va_start(args, fmt);
|
||||
vfprintf(stdout, fmt, args);
|
||||
if (fsxlogf)
|
||||
vfprintf(fsxlogf, fmt, args);
|
||||
vsnprintf(buffer, BUF_SIZE, fmt, args);
|
||||
va_end(args);
|
||||
fprintf(stdout, buffer);
|
||||
if (fsxlogf)
|
||||
fprintf(fsxlogf, buffer);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user