[PATCH] Avoid warnings when p0f is unconfigured
2009-02-14 by Enrico Scholz
There was no way to turn off
| milter-greylist: Cannot connect to p0f socket ""
messages when program was compiled with p0f support and there is no
p0f daemon available/configured.
Such a situation is common e.g. when providing generic binary packages
in a Linux distribution.
This patch skips p0f operations when 'p0fsock' is empty.
Index: milter-greylist-4.2b1/p0f.c
===================================================================
--- milter-greylist-4.2b1.orig/p0f.c
+++ milter-greylist-4.2b1/p0f.c
@@ -284,6 +284,9 @@ p0f_reconnect(void)
if (p0fsock != -1)
return 0;
+ if (!conf.c_p0fsock[0]) /* return silently when p0f is not configured */
+ return -1;
+
if ((p0fsock = socket(PF_UNIX,SOCK_STREAM,0)) == -1) {
mg_log(LOG_ERR, "socket(PF_UNIX, SOCK_STREAM, 0) failed");
exit(EX_OSERR);