From: Sebastian Harl Date: Mon, 4 Dec 2006 22:26:18 +0000 (+0100) Subject: email plugin: "Calculate" UNIX_PATH_MAX if it is not defined. X-Git-Tag: collectd-3.11.0~27 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=33d409e0d68beac9d6d5439a9237b50f28fcd976;p=collectd.git email plugin: "Calculate" UNIX_PATH_MAX if it is not defined. Some systems (e.g. Darwin) do not seem to define UNIX_PATH_MAX at all. Thus I calculate it from the size of the sun_path character array of struct sockaddr_un in this case. Signed-off-by: Sebastian Harl --- diff --git a/src/email.c b/src/email.c index b5d8acfd..404a20a8 100644 --- a/src/email.c +++ b/src/email.c @@ -62,6 +62,11 @@ # include #endif /* HAVE_LINUX_UN_H | HAVE_SYS_UN_H */ +/* some systems (e.g. Darwin) seem to not define UNIX_PATH_MAX at all */ +#ifndef UNIX_PATH_MAX +# define UNIX_PATH_MAX sizeof (((struct sockaddr_un *)0)->sun_path) +#endif /* UNIX_PATH_MAX */ + #if HAVE_GRP_H # include #endif /* HAVE_GRP_H */