16186483 Port openscap 0.9.7 to solaris
16371391 system info probe does not provide phys. interface name, mac addr and IP addr
16597173 File probe crashes when encountering file types of door,port
16908303 oscap leaves too many open file descriptors, processing xccdf
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 ();
}