From 880c4796d80d8f4469aab84610c99542cba6b263 Mon Sep 17 00:00:00 2001 From: Jerry Jelinek Date: Tue, 30 Jun 2015 20:55:16 +0000 Subject: OS-4455 journald exits with 'Unknown socket passed.' --- usr/src/lib/brand/lx/lx_brand/common/socket.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/usr/src/lib/brand/lx/lx_brand/common/socket.c b/usr/src/lib/brand/lx/lx_brand/common/socket.c index f7522963b7..3923f39eb7 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/socket.c +++ b/usr/src/lib/brand/lx/lx_brand/common/socket.c @@ -66,7 +66,8 @@ #define LX_DEV_LOG "/dev/log" #define LX_DEV_LOG_REDIRECT "/var/run/.dev_log_redirect" -#define LX_DEV_LOG_REDIRECT_LEN 18 +#define LX_DEV_LOG_REDIRECT_LEN 18 /* len appended to /dev/log len */ +#define LX_DEV_LOG_REDIRECT_TOT_LEN 26 typedef enum { lxa_none, @@ -1175,6 +1176,19 @@ lx_getsockname(int sockfd, void *np, int *nlp) if (getsockname(sockfd, name, &namelen) < 0) return (-errno); + /* + * See our other handling for LX_DEV_LOG_REDIRECT. We need to change + * the name back to /dev/log since some code depends on that. + */ + if (namelen == (LX_DEV_LOG_REDIRECT_TOT_LEN + sizeof (ushort_t) + 1) && + namelen_orig >= + (LX_DEV_LOG_REDIRECT_TOT_LEN + sizeof (ushort_t) + 1) && + strcmp(name->sa_data, LX_DEV_LOG_REDIRECT) == 0) { + /* we don't check len since we know /dev/log is shorter */ + (void) strcpy(name->sa_data, LX_DEV_LOG); + namelen = strlen(LX_DEV_LOG) + sizeof (ushort_t) + 1; + } + /* * If the name that getsockname() wants to return is larger * than namelen, getsockname() will copy out the maximum amount -- cgit v1.2.3