From 46b4e35255664aac9123231fc02500baac3c1955 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 26 May 2021 09:20:04 +0200 Subject: [PATCH] remote: use defer to replace multiple dh.Close() --- remote/sync/files.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/remote/sync/files.go b/remote/sync/files.go index 112c923..e3fc3d9 100644 --- a/remote/sync/files.go +++ b/remote/sync/files.go @@ -285,9 +285,10 @@ reopen: if err != nil { return err } + defer dh.Close() + err = dh.Chmod(file.Mode) if err != nil { - dh.Close() return err } // Less restrictive access is not relevant here because there @@ -295,10 +296,8 @@ reopen: debugf("chowning %d/%d", file.Uid, file.Gid) err = dh.Chown(file.Uid, file.Gid) if err != nil { - dh.Close() return err } - dh.Close() return nil } // Directory: changed permission or user/group -- 2.45.2