Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ AC_SYS_LARGEFILE

dnl Checks for typedefs, structures, and compiler characteristics.

AC_CHECK_MEMBERS([struct utmpx.ut_name,
struct utmpx.ut_host,
struct utmpx.ut_syslen,
AC_CHECK_MEMBERS([struct utmpx.ut_syslen,
struct utmpx.ut_addr,
struct utmpx.ut_addr_v6,
struct utmpx.ut_time,
Expand Down
12 changes: 0 additions & 12 deletions lib/utmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,12 @@ get_session_host(char **out, pid_t main_pid)

ut = get_current_utmp(main_pid);

#if defined(HAVE_STRUCT_UTMPX_UT_HOST)
if ((ut != NULL) && !strneq_a(ut->ut_host, "")) {
*out = xstrndup_a(ut->ut_host);
} else {
*out = NULL;
ret = -2;
}
#else
*out = NULL;
ret = -2;
#endif

free(ut);

Expand Down Expand Up @@ -277,10 +272,8 @@ prepare_utmp(const char *name, const char *line, const char *host,

if (NULL != host && !streq(host, ""))
hostname = xstrdup(host);
#if defined(HAVE_STRUCT_UTMPX_UT_HOST)
else if (NULL != ut && !strneq_a(ut->ut_host, ""))
hostname = xstrndup_a(ut->ut_host);
#endif

line = strprefix(line, "/dev/") ?: line;

Expand All @@ -296,15 +289,10 @@ prepare_utmp(const char *name, const char *line, const char *host,
} else {
strncpy_a(utent->ut_id, strnul(line) - MIN(strlen(line), countof(utent->ut_id)));
}
#if defined(HAVE_STRUCT_UTMPX_UT_NAME)
strncpy_a(utent->ut_name, name);
#endif
strncpy_a(utent->ut_user, name);
if (NULL != hostname) {
struct addrinfo *info = NULL;
#if defined(HAVE_STRUCT_UTMPX_UT_HOST)
strncpy_a(utent->ut_host, hostname);
#endif
#if defined(HAVE_STRUCT_UTMPX_UT_SYSLEN)
utent->ut_syslen = MIN(strlen(hostname),
sizeof(utent->ut_host));
Expand Down
Loading