about summary refs log tree commit diff stats
path: root/src/LYUtils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/LYUtils.c')
-rw-r--r--src/LYUtils.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 87a059c5..99c611df 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYUtils.c,v 1.177 2008/09/22 22:48:31 tom Exp $
+ * $LynxId: LYUtils.c,v 1.178 2008/12/14 18:42:42 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTCP.h>
@@ -2788,6 +2788,8 @@ void remove_backslashes(char *buf)
  */
 BOOLEAN inlocaldomain(void)
 {
+    int result = TRUE;
+
 #ifdef HAVE_UTMP
     int n;
     FILE *fp;
@@ -2797,6 +2799,7 @@ BOOLEAN inlocaldomain(void)
     if ((cp = ttyname(0)))
 	mytty = LYLastPathSep(cp);
 
+    result = FALSE;
     if (mytty && (fp = fopen(UTMP_FILE, "r")) != NULL) {
 	mytty++;
 	do {
@@ -2804,15 +2807,18 @@ BOOLEAN inlocaldomain(void)
 	} while (n > 0 && !STREQ(me.ut_line, mytty));
 	(void) LYCloseInput(fp);
 
-	if (n > 0 &&
-	    strlen(me.ut_host) > strlen(LYLocalDomain) &&
-	    STREQ(LYLocalDomain,
-		  me.ut_host + strlen(me.ut_host) - strlen(LYLocalDomain)))
-	    return (TRUE);
+	if (n > 0) {
+	    if (strlen(me.ut_host) > strlen(LYLocalDomain) &&
+		STREQ(LYLocalDomain,
+		      me.ut_host + strlen(me.ut_host) - strlen(LYLocalDomain))) {
+		result = TRUE;
+	    }
 #ifdef LINUX
-/* Linux fix to check for local user. J.Cullen 11Jul94		*/
-	if ((n > 0) && (strlen(me.ut_host) == 0))
-	    return (TRUE);
+	    /* Linux fix to check for local user. J.Cullen 11Jul94              */
+	    else if (strlen(me.ut_host) == 0) {
+		result = TRUE;
+	    }
+	}
 #endif /* LINUX */
 
     } else {
@@ -2820,12 +2826,10 @@ BOOLEAN inlocaldomain(void)
 		"Could not get ttyname (returned %s) or open UTMP file %s\n",
 		NONNULL(cp), UTMP_FILE));
     }
-
-    return (FALSE);
 #else
-    CTRACE((tfp, "LYUtils: inlocaldomain() not support.\n"));
-    return (TRUE);
+    CTRACE((tfp, "LYUtils: inlocaldomain() not supported.\n"));
 #endif /* HAVE_UTMP */
+    return (result);
 }
 
 #ifdef HAVE_SIGACTION