[pmg-devel] [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config

Max R. Carrara m.carrara at proxmox.com
Mon Sep 22 17:24:57 CEST 2025


If `/run/pmg-smtp-filter.cfg` doesn't yet exist when `pmgsync.service`
runs, a "No such file or directory" warning is logged. While this has
been around since a while [0], the warning might look suspicious to
some (as it did to me during testing).

Therefore, handle ENOENT separately without emitting any warnings.

[0]: https://git.proxmox.com/?p=pmg-api.git;a=commitdiff;h=e5b31a6178118981e784b225941f1502ba644ee5

Signed-off-by: Max R. Carrara <m.carrara at proxmox.com>
---
 src/PMG/Config.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 44e5463..46e8aa2 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -1909,7 +1909,9 @@ sub compare_smtp_filter_config {
     my $old;
     eval { $old = PVE::Tools::file_get_contents($smtp_filter_cfg); };
 
-    if (my $err = $@) {
+    if ($!{ENOENT}) {
+        $ret = 1;
+    } elsif (my $err = $@) {
         syslog('warning', "reloading pmg-smtp-filter: $err");
         $ret = 1;
     } else {
-- 
2.47.3





More information about the pmg-devel mailing list