summaryrefslogtreecommitdiffstats
path: root/source/a/shadow/shadow.login.display.short.hostname.diff
blob: ad5c3eba675d914f5f29470872afa8eeb44813c2 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--- ./libmisc/loginprompt.c.orig	2014-03-01 12:59:51.000000000 -0600
+++ ./libmisc/loginprompt.c	2017-11-21 18:17:27.492000123 -0600
@@ -99,6 +99,15 @@
 			}
 		}
 		(void) gethostname (buf, sizeof buf);
+		/* Trim away everything after the first '.': */
+		i = 0;
+		while (buf[i] != '\0' && i < sizeof(buf) - 1) {
+			if (buf[i] == '.') {
+				buf[i] = '\0';
+				break;
+			}
+			i++;
+		}
 		printf (prompt, buf);
 		(void) fflush (stdout);
 	}