mirror of
https://github.com/rclone/rclone.git
synced 2024-11-29 20:04:52 +01:00
7d0d7e66ca
If a file handle is duplicated with dup() and the duplicate handle is flushed, rclone will go ahead and close the file, making the original file handle stale. This change removes the close() call from Flush() and replaces it with FlushWrites() so that the file only gets closed when Release() is called. The new FlushWrites method takes care of actually writing the file back to the underlying storage. Fixes #3381
26 lines
617 B
Go
26 lines
617 B
Go
// +build !linux,!darwin,!freebsd
|
|
|
|
package mounttest
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
// TestWriteFileDoubleClose tests double close on write
|
|
func TestWriteFileDoubleClose(t *testing.T) {
|
|
t.Skip("not supported on " + runtime.GOOS)
|
|
}
|
|
|
|
// writeTestDup performs the platform-specific implementation of the dup() syscall
|
|
func writeTestDup(oldfd uintptr) (uintptr, error) {
|
|
p, err := windows.GetCurrentProcess()
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
var h windows.Handle
|
|
return uintptr(h), windows.DuplicateHandle(p, windows.Handle(oldfd), p, &h, 0, true, windows.DUPLICATE_SAME_ACCESS)
|
|
}
|