Module Name:    src
Committed By:   kim
Date:           Tue Jun 30 14:57:25 UTC 2020

Modified Files:
        src/usr.bin/w: w.c

Log Message:
Compute a value for domain before comparing against it


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/w/w.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/w/w.c
diff -u src/usr.bin/w/w.c:1.84 src/usr.bin/w/w.c:1.85
--- src/usr.bin/w/w.c:1.84	Tue Oct 30 21:15:09 2018
+++ src/usr.bin/w/w.c	Tue Jun 30 14:57:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: w.c,v 1.84 2018/10/30 21:15:09 kre Exp $	*/
+/*	$NetBSD: w.c,v 1.85 2020/06/30 14:57:25 kim Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)w.c	8.6 (Berkeley) 6/30/94";
 #else
-__RCSID("$NetBSD: w.c,v 1.84 2018/10/30 21:15:09 kre Exp $");
+__RCSID("$NetBSD: w.c,v 1.85 2020/06/30 14:57:25 kim Exp $");
 #endif
 #endif /* not lint */
 
@@ -205,6 +205,18 @@ main(int argc, char **argv)
 			curtain = 0;
 	}
 
+	if (!nflag) {
+		int	rv;
+		char	*p;
+
+		rv = gethostname(domain, sizeof(domain));
+		domain[sizeof(domain) - 1] = '\0';
+		if (rv < 0 || (p = strchr(domain, '.')) == 0)
+			domain[0] = '\0';
+		else
+			memmove(domain, p, strlen(p) + 1);
+	}
+
 #ifdef SUPPORT_UTMPX
 	setutxent();
 #endif
@@ -388,18 +400,6 @@ main(int argc, char **argv)
 	}
 #endif
 
-	if (!nflag) {
-		int	rv;
-		char	*p;
-
-		rv = gethostname(domain, sizeof(domain));
-		domain[sizeof(domain) - 1] = '\0';
-		if (rv < 0 || (p = strchr(domain, '.')) == 0)
-			domain[0] = '\0';
-		else
-			memmove(domain, p, strlen(p) + 1);
-	}
-
 	for (ep = ehead; ep != NULL; ep = ep->next) {
 		if (ep->tp != NULL)
 			kp = ep->tp;

Reply via email to