mirror of
https://github.com/Picocrypt/Picocrypt.git
synced 2025-05-12 05:48:30 +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
|
||||
startTime := time.Now()
|
||||
for i := 0; i < totalFiles; i++ {
|
||||
for i := range totalFiles {
|
||||
fin, err := os.Open(fmt.Sprintf("%s.%d", inputFile, i))
|
||||
if err != nil {
|
||||
fout.Close()
|
||||
|
@ -1387,10 +1387,11 @@ func work() {
|
|||
break
|
||||
}
|
||||
data = data[:read]
|
||||
_, err = fout.Write(data)
|
||||
var n int
|
||||
n, err = fout.Write(data)
|
||||
done += read
|
||||
|
||||
if err != nil {
|
||||
if err != nil || n != len(data) {
|
||||
insufficientSpace(fin, fout)
|
||||
os.Remove(outputFile + ".pcv")
|
||||
return
|
||||
|
@ -1402,9 +1403,13 @@ func work() {
|
|||
popupStatus = fmt.Sprintf("Recombining at %.2f MiB/s (ETA: %s)", speed, eta)
|
||||
giu.Update()
|
||||
}
|
||||
fin.Close()
|
||||
if err := fin.Close(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
if err := fout.Close(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fout.Close()
|
||||
inputFileOld = inputFile
|
||||
inputFile = outputFile + ".pcv"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue