From: Filip Schauer <f.schauer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 container 2/2] fix undef warning when apparmor changeprofile fails
Date: Mon, 25 Mar 2024 18:28:29 +0100 [thread overview]
Message-ID: <20240325172829.26262-3-f.schauer@proxmox.com> (raw)
In-Reply-To: <20240325172829.26262-1-f.schauer@proxmox.com>
Fix a "Use of uninitialized value in numeric ne (!=)" warning when
syswrite returns undef when trying to change the apparmor profile.
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
src/PVE/LXC.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 7db4833..88a9d6f 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1975,7 +1975,8 @@ sub mountpoint_hotplug :prototype($$$$$) {
# Now switch our apparmor profile before mounting:
my $data = 'changeprofile pve-container-mounthotplug';
- if (syswrite($aa_fd, $data, length($data)) != length($data)) {
+ my $data_written = syswrite($aa_fd, $data, length($data));
+ if (!defined($data_written) || $data_written != length($data)) {
die "failed to change apparmor profile: $!\n";
}
# Check errors on close as well:
--
2.39.2
prev parent reply other threads:[~2024-03-25 17:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 17:28 [pve-devel] [PATCH v2 container 0/2] fix #5160: fix move_mount regression for mount point hotplug Filip Schauer
2024-03-25 17:28 ` [pve-devel] [PATCH v2 container 1/2] " Filip Schauer
2024-04-09 8:23 ` Wolfgang Bumiller
2024-04-09 9:27 ` Filip Schauer
2024-03-25 17:28 ` Filip Schauer [this message]
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=20240325172829.26262-3-f.schauer@proxmox.com \
--to=f.schauer@proxmox.com \
--cc=pve-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