fix problem with hostname returning name w/o a domain
authorJim Bloom <bloom@ucbvax.Berkeley.EDU>
Tue, 10 Sep 1985 07:29:08 +0000 (23:29 -0800)
committerJim Bloom <bloom@ucbvax.Berkeley.EDU>
Tue, 10 Sep 1985 07:29:08 +0000 (23:29 -0800)
SCCS-vsn: lib/libc/net/rcmd.c 5.4

usr/src/lib/libc/net/rcmd.c

index 31a7a2d..19f00d2 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)rcmd.c     5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)rcmd.c     5.4 (Berkeley) %G%";
 #endif not lint
 
 #include <stdio.h>
 #endif not lint
 
 #include <stdio.h>
@@ -230,7 +230,8 @@ int len;
                        return(0);
                }
                ldomain[MAXHOSTNAMELEN] = NULL;
                        return(0);
                }
                ldomain[MAXHOSTNAMELEN] = NULL;
-               domainp = index(ldomain, '.') + 1;
+               if ((domainp = index(ldomain, '.') + 1) == (char *)1)
+                       return(0);
                cp = domainp;
                while (*cp)
                        *cp++ = isupper(*cp) ? tolower(*cp) : *cp;
                cp = domainp;
                while (*cp)
                        *cp++ = isupper(*cp) ? tolower(*cp) : *cp;