summaryrefslogtreecommitdiffstats
path: root/login-utils/agetty.c
diff options
context:
space:
mode:
authorKarel Zak2007-11-26 14:45:55 +0100
committerKarel Zak2007-11-26 14:49:57 +0100
commit77337bfb7f05f3f0d5cca5d4c9feb0771f87af0c (patch)
tree7e3649091471ca349f98d5e20749b06e5405f867 /login-utils/agetty.c
parentcfdisk: display cylinders beyond 1024 (diff)
downloadkernel-qcow2-util-linux-77337bfb7f05f3f0d5cca5d4c9feb0771f87af0c.tar.gz
kernel-qcow2-util-linux-77337bfb7f05f3f0d5cca5d4c9feb0771f87af0c.tar.xz
kernel-qcow2-util-linux-77337bfb7f05f3f0d5cca5d4c9feb0771f87af0c.zip
agetty: cleanup MAXHOSTNAMELEN
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/agetty.c')
-rw-r--r--login-utils/agetty.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/login-utils/agetty.c b/login-utils/agetty.c
index 6640cf2b0..cbae09231 100644
--- a/login-utils/agetty.c
+++ b/login-utils/agetty.c
@@ -116,22 +116,12 @@
#define TCSETAW TCSETSW
#endif
- /*
- * This program tries to not use the standard-i/o library. This keeps the
- * executable small on systems that do not have shared libraries (System V
- * Release <3).
- */
-#ifndef BUFSIZ
-#define BUFSIZ 1024
-#endif
-
-/* set a maximum length for the hostname, */
-#ifdef HOST_NAME_MAX
-# define HOSTNAME_LENGTH HOST_NAME_MAX /* defined by POSIX.1 */
-#elif defined(MAXHOSTNAMELEN)
-# define HOSTNAME_LENGTH MAXHOSTNAMELEN /* implemented in current Unix-versions */
-#else
-# define HOSTNAME_LENGTH 255
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+# define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+# define MAXHOSTNAMELEN 64
+# endif
#endif
/*
@@ -884,7 +874,7 @@ do_prompt(op, tp)
case 'o':
{
- char domainname[HOST_NAME_MAX+1];
+ char domainname[MAXHOSTNAMELEN+1];
#ifdef HAVE_GETDOMAINNAME
if (getdomainname(domainname, sizeof(domainname)))
#endif
@@ -897,7 +887,7 @@ do_prompt(op, tp)
case 'O':
{
char *dom = "unknown_domain";
- char host[HOST_NAME_MAX + 1];
+ char host[MAXHOSTNAMELEN+1];
struct addrinfo hints, *info = NULL;
memset(&hints, 0, sizeof(hints));
@@ -992,7 +982,7 @@ do_prompt(op, tp)
}
#endif
{
- char hn[HOST_NAME_MAX+1];
+ char hn[MAXHOSTNAMELEN+1];
if (gethostname(hn, sizeof(hn)) == 0)
write(1, hn, strlen(hn));
}