[PATCH 3/7] last, login, write: Provide a fallback for MAXHOSTNAMELEN, as elsewhere.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Thomas Schwinge <thomas@xxxxxxxxxxxxxxxx>
---
 login-utils/last.c  |    8 ++++++++
 login-utils/login.c |    8 ++++++++
 term-utils/write.c  |    8 ++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/login-utils/last.c b/login-utils/last.c
index 1b1bee1..4d09c4b 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -62,6 +62,14 @@
 #include "xalloc.h"
 #include "c.h"
 
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+#  define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+#  define MAXHOSTNAMELEN 64
+# endif
+#endif
+
 #define	SECDAY	(24*60*60)			/* seconds in a day */
 #define	NO	0				/* false/no */
 #define	YES	1				/* true/yes */
diff --git a/login-utils/login.c b/login-utils/login.c
index 7b4f8b5..f459b79 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -71,6 +71,14 @@
 
 #include "logindefs.h"
 
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+#  define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+#  define MAXHOSTNAMELEN 64
+# endif
+#endif
+
 #define is_pam_failure(_rc)	((_rc) != PAM_SUCCESS)
 
 #define LOGIN_MAX_TRIES        3
diff --git a/term-utils/write.c b/term-utils/write.c
index 2a94792..c8aca7e 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -65,6 +65,14 @@
 #include "closestream.h"
 #include "nls.h"
 
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+#  define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+#  define MAXHOSTNAMELEN 64
+# endif
+#endif
+
 static void __attribute__ ((__noreturn__)) usage(FILE * out);
 void search_utmp(char *, char *, char *, uid_t);
 void do_write(char *, char *, uid_t);
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux