From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup] config: lock guard: label BackupLockGuard by must_use attribute
Date: Wed, 15 Apr 2026 10:31:45 +0200 [thread overview]
Message-ID: <20260415083146.187139-1-c.ebner@proxmox.com> (raw)
The BackupLockGuard is used to store the open file descriptor of a
flocked file. Once dropped, the file lock is release.
Since not binding the BackupLockGuard to a variable will result in
dropping of the struct and therefore immediate unlocking of the file,
set the must_use attribute with a meaningful description to get
clippy warnings for this.
Suggested-by: Daniel Kral <d.kral@proxmox.com>
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
pbs-config/src/lib.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/pbs-config/src/lib.rs b/pbs-config/src/lib.rs
index 18b27d23a..88a31904f 100644
--- a/pbs-config/src/lib.rs
+++ b/pbs-config/src/lib.rs
@@ -59,6 +59,7 @@ pub fn priv_user() -> Result<nix::unistd::User, Error> {
}
}
+#[must_use = "lock guard must be used to keep file locked"]
pub struct BackupLockGuard {
file: Option<std::fs::File>,
// TODO: Remove `_legacy_dir` with PBS 5
--
2.47.3
reply other threads:[~2026-04-15 8:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260415083146.187139-1-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox