15997718 Interface addition/deletion causing frequent error messages in snmpd.log
17208688 MIB II SNMP table data discrepancy for network interfaces
16356248 snmpd unresponsive for 30 seconds after start with monitors set in snmpd.conf
17651108 snmpd dumps core when there are duplicate "exec" entries in snmpd.conf
This patch fixes debug logging so that it works on solaris.
This patch has not been contributed upstream, but is planned to be done by
2013-Jul-12.
--- openscap-0.8.1/src/common/debug.c.orig 2012-11-19 10:04:47.622821073 -0800
+++ openscap-0.8.1/src/common/debug.c 2012-11-19 09:58:03.173819234 -0800
@@ -150,7 +150,11 @@
else
f = file;
+#if defined(__SVR4) && defined (__sun)
+ if (lockf(fileno(__debuglog_fp), F_LOCK, 0L) == -1) {
+#else
if (flock(fileno(__debuglog_fp), LOCK_EX) == -1) {
+#endif
__UNLOCK_FP;
return;
}
@@ -178,7 +182,11 @@
#endif
vfprintf(__debuglog_fp, fmt, ap);
+#if defined(__SVR4) && defined (__sun)
+ if (lockf(fileno(__debuglog_fp), F_ULOCK, 0L) == -1) {
+#else
if (flock(fileno(__debuglog_fp), LOCK_UN) == -1) {
+#endif
/* __UNLOCK_FP; */
abort();
}
@@ -232,8 +240,11 @@
fprintf (__debuglog_fp, "=============== LOG: %.24s ===============\n", st);
atexit(&__oscap_debuglog_close);
}
-
+#if defined(__SVR4) && defined (__sun)
+ if (lockf (fileno (__debuglog_fp), F_LOCK, 0L) == -1) {
+#else
if (flock (fileno (__debuglog_fp), LOCK_EX | LOCK_NB) == -1) {
+#endif
__UNLOCK_FP;
return;
}
@@ -251,8 +262,11 @@
}
fprintf(__debuglog_fp, "\n-----------\n");
-
+#if defined(__SVR4) && defined (__sun)
+ if (lockf (fileno (__debuglog_fp), F_ULOCK, 0L) == -1) {
+#else
if (flock (fileno (__debuglog_fp), LOCK_UN | LOCK_NB) == -1) {
+#endif
/* __UNLOCK_FP; */
abort ();
}