summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2015-06-30 20:55:16 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2015-06-30 20:55:16 +0000
commit880c4796d80d8f4469aab84610c99542cba6b263 (patch)
tree11f8b038d7cd9a523f7647aaaf90bae44adfcb6b
parent154f0da4b36935d655c685c7baea24d009e3dec0 (diff)
downloadillumos-joyent-880c4796d80d8f4469aab84610c99542cba6b263.tar.gz
OS-4455 journald exits with 'Unknown socket passed.'
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/socket.c16
1 files changed, 15 insertions, 1 deletions
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,
@@ -1176,6 +1177,19 @@ lx_getsockname(int sockfd, void *np, int *nlp)
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
* of data possible and then update namelen to indicate the