]> err.no Git - util-linux/commitdiff
agetty: cleanup MAXHOSTNAMELEN
authorKarel Zak <kzak@redhat.com>
Mon, 26 Nov 2007 13:45:55 +0000 (14:45 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 26 Nov 2007 13:49:57 +0000 (14:49 +0100)
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/agetty.c

index 6640cf2b02addcc37b9b2515f57055b1ebeb664a..cbae09231a62b4ccea91c998e2699e9be337235f 100644 (file)
 #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));
     }