From a2172dc0b913c15eb701e644cf67e2db2a1b7f22 Mon Sep 17 00:00:00 2001 From: Cassondra Foesch Date: Thu, 27 Feb 2025 13:51:25 +0000 Subject: [PATCH] short-circuit File.Sync if not supported --- client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client.go b/client.go index b747642..73f65cf 100644 --- a/client.go +++ b/client.go @@ -2122,6 +2122,13 @@ func (f *File) Sync() error { 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() typ, data, err := f.c.sendPacket(context.Background(), nil, &sshFxpFsyncPacket{ ID: id,