From 3aa8bbbf81d531fdb7a07ac71333a5e2b675be70 Mon Sep 17 00:00:00 2001 From: angelo Date: Fri, 21 Jul 1995 10:44:39 +0000 Subject: [PATCH] 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 --- ba/ba2200.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ba/ba2200.cpp b/ba/ba2200.cpp index 9dfab878a..a2936fc5c 100755 --- a/ba/ba2200.cpp +++ b/ba/ba2200.cpp @@ -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();