File: agent_silent_eacces

package info (click to toggle)
net-snmp 5.9.5.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 37,776 kB
  • sloc: ansic: 283,260; perl: 17,711; sh: 12,286; makefile: 2,711; python: 734; xml: 660; pascal: 62; sql: 47
file content (31 lines) | stat: -rw-r--r-- 998 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Description: Be quiet on access error 
 SNMP agents can legitimately be not allowed to access mount points, such as
 trying to get to things under /run/user. This patch changes a EACCES error to
 a debug message.
Author: Craig Small <csmall@debian.org>
Origin: Debian
Bug-Debian: https://bugs.debian.org/792832
Reviewed-by: Craig Small <csmall@debian.org>
Last-Update: 2025-12-23
--- a/agent/mibgroup/hardware/fsys/fsys_mntent.c
+++ b/agent/mibgroup/hardware/fsys/fsys_mntent.c
@@ -6,6 +6,7 @@
 #include "hardware/fsys/hw_fsys_private.h"
 
 #include <stdio.h>
+#include <errno.h>
 #ifdef HAVE_MNTENT_H
 #include <mntent.h>
 #endif
@@ -321,7 +322,10 @@
 
             if (!logged &&
                 asprintf(&tmpbuf, "Cannot statfs %s", entry->path) >= 0) {
-                snmp_log_perror(tmpbuf);
+		if (errno == EACCES)
+		    DEBUGMSGTL(("fsys", "%s\n", tmpbuf));
+		else
+                    snmp_log_perror(tmpbuf);
                 free(tmpbuf);
                 logged = 1;
             }