summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/prompt.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-03-08 23:51:50 +0000
committerbrian <brian@FreeBSD.org>2001-03-08 23:51:50 +0000
commit298eccdc148d36583de336afa8746580f3a33aff (patch)
tree4930fa9219854ec1b2631e7ff7770d40461aee98 /usr.sbin/ppp/prompt.c
parent4010cd1c76927246d32483cd92a0c8cb0c42a159 (diff)
downloadFreeBSD-src-298eccdc148d36583de336afa8746580f3a33aff.zip
FreeBSD-src-298eccdc148d36583de336afa8746580f3a33aff.tar.gz
MAXPATHLEN -> PATH_MAX
Don't assume MAXHOSTNAMELEN includes the NUL Correct a diagnostic Use "localhost" in our prompt instead of ""
Diffstat (limited to 'usr.sbin/ppp/prompt.c')
-rw-r--r--usr.sbin/ppp/prompt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/ppp/prompt.c b/usr.sbin/ppp/prompt.c
index 46fb9ee..0aafbe3 100644
--- a/usr.sbin/ppp/prompt.c
+++ b/usr.sbin/ppp/prompt.c
@@ -79,7 +79,7 @@ static void
prompt_Display(struct prompt *p)
{
/* XXX: See Index2Nam() - should we only figure this out once ? */
- static char shostname[MAXHOSTNAMELEN];
+ static char shostname[MAXHOSTNAMELEN + 1];
const char *pconnect, *pauth;
if (p->TermMode || !p->needprompt)
@@ -109,7 +109,7 @@ prompt_Display(struct prompt *p)
if (*shostname == '\0') {
char *dot;
- if (gethostname(shostname, sizeof shostname))
+ if (gethostname(shostname, sizeof shostname) || *shostname == '\0')
strcpy(shostname, "localhost");
else if ((dot = strchr(shostname, '.')))
*dot = '\0';
OpenPOWER on IntegriCloud