mirror of
https://github.com/Picocrypt/Picocrypt.git
synced 2025-05-12 13:48:31 +02:00
handle more errors in recombine code
This commit is contained in:
parent
7a28e2b273
commit
d0e4e71b97
1 changed files with 10 additions and 5 deletions
|
@ -1363,7 +1363,7 @@ func work() {
|
||||||
|
|
||||||
// Merge all chunks into one file
|
// Merge all chunks into one file
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
for i := 0; i < totalFiles; i++ {
|
for i := range totalFiles {
|
||||||
fin, err := os.Open(fmt.Sprintf("%s.%d", inputFile, i))
|
fin, err := os.Open(fmt.Sprintf("%s.%d", inputFile, i))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fout.Close()
|
fout.Close()
|
||||||
|
@ -1387,10 +1387,11 @@ func work() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
data = data[:read]
|
data = data[:read]
|
||||||
_, err = fout.Write(data)
|
var n int
|
||||||
|
n, err = fout.Write(data)
|
||||||
done += read
|
done += read
|
||||||
|
|
||||||
if err != nil {
|
if err != nil || n != len(data) {
|
||||||
insufficientSpace(fin, fout)
|
insufficientSpace(fin, fout)
|
||||||
os.Remove(outputFile + ".pcv")
|
os.Remove(outputFile + ".pcv")
|
||||||
return
|
return
|
||||||
|
@ -1402,9 +1403,13 @@ func work() {
|
||||||
popupStatus = fmt.Sprintf("Recombining at %.2f MiB/s (ETA: %s)", speed, eta)
|
popupStatus = fmt.Sprintf("Recombining at %.2f MiB/s (ETA: %s)", speed, eta)
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}
|
}
|
||||||
fin.Close()
|
if err := fin.Close(); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := fout.Close(); err != nil {
|
||||||
|
panic(err)
|
||||||
}
|
}
|
||||||
fout.Close()
|
|
||||||
inputFileOld = inputFile
|
inputFileOld = inputFile
|
||||||
inputFile = outputFile + ".pcv"
|
inputFile = outputFile + ".pcv"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue