Delete the output file upon errors

This commit is contained in:
Pierre Pronchery 2013-04-07 03:23:52 +02:00
parent 440d9618c8
commit ea9fc2b0f4

View File

@ -372,11 +372,15 @@ static int _common_task_save_buffer_as(CommonTask * task, char const * filename)
{
g_free(buf);
fclose(fp);
unlink(filename);
return -_common_task_error(task, strerror(errno), 1);
}
g_free(buf);
if(fclose(fp) != 0)
{
unlink(filename);
return -_common_task_error(task, strerror(errno), 1);
}
return 0;
}