From ae63aec32fe70c5167d6bfafbc532b2b1286fc09 Mon Sep 17 00:00:00 2001 From: Max Asnaashari Date: Wed, 21 Feb 2024 17:52:49 +0000 Subject: [PATCH] lxd/rsync: Add description of cleanup function to RunWrappers Signed-off-by: Max Asnaashari --- lxd/apparmor/rsync.go | 1 + lxd/rsync/rsync.go | 1 + 2 files changed, 2 insertions(+) diff --git a/lxd/apparmor/rsync.go b/lxd/apparmor/rsync.go index cd232f937707..a12a153a950f 100644 --- a/lxd/apparmor/rsync.go +++ b/lxd/apparmor/rsync.go @@ -72,6 +72,7 @@ profile "{{ .name }}" flags=(attach_disconnected,mediate_deleted) { `)) // RsyncWrapper is used as a RunWrapper in the rsync package. +// It returns a cleanup function that deletes the AppArmor profile that the command is running in. func RsyncWrapper(sysOS *sys.OS, cmd *exec.Cmd, sourcePath string, dstPath string) (func(), error) { if !sysOS.AppArmorAvailable { return func() {}, nil diff --git a/lxd/rsync/rsync.go b/lxd/rsync/rsync.go index 6a156beaf7c5..4fe648daff2e 100644 --- a/lxd/rsync/rsync.go +++ b/lxd/rsync/rsync.go @@ -23,6 +23,7 @@ import ( var Debug bool // RunWrapper is an optional function that's used to wrap rsync, useful for confinement like AppArmor. +// It returns a cleanup function that will close the wrapper's environment, and should be called after the command has completed. var RunWrapper func(cmd *exec.Cmd, source string, destination string) (func(), error) // rsync is a wrapper for the rsync command which will respect RunWrapper.