Skip to content

Commit

Permalink
OS-4455 journald exits with 'Unknown socket passed.'
Browse files Browse the repository at this point in the history
  • Loading branch information
jjelinek committed Jun 30, 2015
1 parent 154f0da commit 880c479
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion usr/src/lib/brand/lx/lx_brand/common/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 880c479

Please sign in to comment.