--- utmp.c.orig 2015-08-15 01:22:46.000000000 -0400
+++ utmp.c 2015-08-15 01:23:20.000000000 -0400
@@ -26,6 +26,7 @@
****************************************************************
*/
+#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -151,7 +152,7 @@
* how = 0 try to withdraw a utmp slot.
*
* w_slot = -1 window not logged in.
- * w_slot = 0 window not logged in, but should be logged in.
+ * w_slot = 0 window not logged in, but should be logged in.
* (unable to write utmp, or detached).
*/
@@ -400,7 +401,7 @@
* down the name of his terminal line; else he is remote and we keep
* the hostname here. The letter S and the window id will be appended.
* A saved utmp entry in wi->w_savut serves as a template, usually.
- */
+ */
int
SetUtmp(wi)
@@ -409,12 +410,6 @@
register slot_t slot;
struct utmp u;
int saved_ut;
-#ifdef UTHOST
- char *p;
- char host[sizeof(D_loginhost) + 15];
-#else
- char *host = 0;
-#endif /* UTHOST */
wi->w_slot = (slot_t)0;
if (!utmpok || wi->w_type != W_TYPE_PTY)
@@ -435,51 +430,12 @@
makeuser(&u, stripdev(wi->w_tty), LoginName, wi->w_pid);
#ifdef UTHOST
- host[sizeof(host) - 15] = '\0';
- if (display)
- {
- strncpy(host, D_loginhost, sizeof(host) - 15);
- if (D_loginslot != (slot_t)0 && D_loginslot != (slot_t)-1 && host[0] != '\0')
- {
- /*
- * we want to set our ut_host field to something like
- * ":ttyhf:s.0" or
- * "faui45:s.0" or
- * "132.199.81.4:s.0" (even this may hurt..), but not
- * "faui45.informati"......:s.0
- * HPUX uses host:0.0, so chop at "." and ":" (Eric Backus)
- */
- for (p = host; *p; p++)
- if ((*p < '0' || *p > '9') && (*p != '.'))
- break;
- if (*p)
- {
- for (p = host; *p; p++)
- if (*p == '.' || (*p == ':' && p != host))
- {
- *p = '\0';
- break;
- }
- }
- }
- else
- {
- strncpy(host + 1, stripdev(D_usertty), sizeof(host) - 15 - 1);
- host[0] = ':';
- }
- }
- else
- strncpy(host, "local", sizeof(host) - 15);
-
- sprintf(host + strlen(host), ":S.%d", wi->w_number);
- debug1("rlogin hostname: '%s'\n", host);
-
# if !defined(_SEQUENT_) && !defined(sequent)
- strncpy(u.ut_host, host, sizeof(u.ut_host));
+ strncpy(u.ut_host, D_loginhost, sizeof(u.ut_host));
# endif
#endif /* UTHOST */
- if (pututslot(slot, &u, host, wi) == 0)