Corretto errore MI3158. Modificata scrittura sui dischi di backup (ora

il file viene troncato con una chsize).


git-svn-id: svn://10.65.10.50/trunk@1630 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1995-07-21 10:44:39 +00:00
parent d7f4126c1f
commit 3aa8bbbf81

View File

@ -183,6 +183,7 @@ bool TArchive::fsplit(const char* filename, char floppy, const char* desc) const
setvbuf(i, NULL, _IOFBF, BUFSIZE);
const long tot = fsize(i);
long scritti=0;
TFilename work;
work << floppy << ":/" << from.name(); // File su dischetto
@ -204,8 +205,14 @@ bool TArchive::fsplit(const char* filename, char floppy, const char* desc) const
ok = FALSE;
if (!ok)
{
if (o != NULL) fclose(o);
{
if (o != NULL)
{
chsize(fileno(o),scritti); // Must truncate output file or some information will be rewritten on next disk!
scritti = 0; // Reset count bytes written to disk.
fclose(o);
}
o = ask_disk(work, ++disk, floppy, FALSE);
ok = o != NULL;
if (ok)
@ -240,9 +247,12 @@ bool TArchive::fsplit(const char* filename, char floppy, const char* desc) const
ok = (letti > 0) ? (fwrite((char*)(const char*)buffer, letti, 1, o) == 1) : TRUE;
if (!ok) error_box("Impossibile scrivere i dati sul dischetto");
else
scritti +=letti;
}
}
else
scritti += letti;
w.addstatus(letti);
if (ok)
ok = !w.iscancelled();