mirror of https://github.com/pkg/sftp.git
short-circuit File.Sync if not supported
This commit is contained in:
parent
fb0652cf58
commit
a2172dc0b9
|
@ -2122,6 +2122,13 @@ func (f *File) Sync() error {
|
||||||
return os.ErrClosed
|
return os.ErrClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if data, ok := f.c.HasExtension(openssh.ExtensionFSync().Name); !ok || data != "1" {
|
||||||
|
return &StatusError{
|
||||||
|
Code: sshFxOPUnsupported,
|
||||||
|
msg: "fsync not supported",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
id := f.c.nextID()
|
id := f.c.nextID()
|
||||||
typ, data, err := f.c.sendPacket(context.Background(), nil, &sshFxpFsyncPacket{
|
typ, data, err := f.c.sendPacket(context.Background(), nil, &sshFxpFsyncPacket{
|
||||||
ID: id,
|
ID: id,
|
||||||
|
|
Loading…
Reference in New Issue