nonlib: Use tmp file when generating snapshot.
This commit is contained in:
parent
14099b7cfc
commit
7d5a0e13f6
|
@ -568,13 +568,21 @@ Loggable::snapshot ( const char *name )
|
|||
{
|
||||
FILE *fp;
|
||||
|
||||
if ( ! ( fp = fopen( name, "w" ) ))
|
||||
char *tmpname;
|
||||
|
||||
asprintf( &tmpname, ".#%s", name );
|
||||
|
||||
if ( ! ( fp = fopen( tmpname, "w" ) ))
|
||||
return false;
|
||||
|
||||
bool r = snapshot( fp );
|
||||
|
||||
fclose( fp );
|
||||
|
||||
rename( tmpname, name );
|
||||
|
||||
free(tmpname);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue