Connect to syslogd using SYSLOG_UNIX_PATH variable, if set

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-11-03 15:52:13 +01:00
parent cedff49662
commit fe3066f4c2

View File

@ -490,7 +490,11 @@ connectlog_r(struct syslog_data *data)
#endif
.sun_path = _PATH_LOG,
};
char *path;
path = getenv("SYSLOG_UNIX_PATH");
if (!data->log_sockpath && path)
data->log_sockpath = path;
if (data->log_sockpath && !access(data->log_sockpath, W_OK))
strlcpy(sun.sun_path, data->log_sockpath, sizeof(sun.sun_path));