mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
fix file descriptor
This commit is contained in:
parent
5b5c05d694
commit
edda09df00
1 changed files with 2 additions and 2 deletions
|
@ -259,7 +259,7 @@ func receive(forceSend int, serverAddress string, tcpPorts []string, isLocal boo
|
||||||
var fProgress *os.File
|
var fProgress *os.File
|
||||||
var progressErr error
|
var progressErr error
|
||||||
if resumeFile {
|
if resumeFile {
|
||||||
fProgress, progressErr = os.OpenFile(progressFile, os.O_APPEND, 0644)
|
fProgress, progressErr = os.OpenFile(progressFile, os.O_APPEND|os.O_WRONLY, 0644)
|
||||||
bytesWritten = len(blocks) * blockSize
|
bytesWritten = len(blocks) * blockSize
|
||||||
} else {
|
} else {
|
||||||
os.Remove(progressFile)
|
os.Remove(progressFile)
|
||||||
|
@ -321,11 +321,11 @@ func receive(forceSend int, serverAddress string, tcpPorts []string, isLocal boo
|
||||||
log.Debugf("writing to location %d (%2.0f/%2.0f)", bytesWritten, blocksWritten, blocksToWrite)
|
log.Debugf("writing to location %d (%2.0f/%2.0f)", bytesWritten, blocksWritten, blocksToWrite)
|
||||||
fProgress.WriteString(fmt.Sprintf("%d\n", bytesWritten))
|
fProgress.WriteString(fmt.Sprintf("%d\n", bytesWritten))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the bytes written
|
// update the bytes written
|
||||||
bytesWritten += n
|
bytesWritten += n
|
||||||
blocksWritten += 1.0
|
blocksWritten += 1.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue