Skip to content
Snippets Groups Projects
Commit 3ccf786a authored by Fons Rademakers's avatar Fons Rademakers
Browse files

make sure that the utmp host field is not truncated. Could easily happen on

Mac OS X where the host field is only 16 long.


git-svn-id: http://root.cern.ch/svn/root/trunk@14647 27541ba8-7e3a-0410-8455-c3a389f83636
parent 9a067d77
No related branches found
No related tags found
No related merge requests found
// @(#)root/rootx:$Name: $:$Id: rootx.cxx,v 1.18 2005/09/04 09:13:27 brun Exp $
// @(#)root/rootx:$Name: $:$Id: rootx.cxx,v 1.19 2005/09/13 13:29:51 rdm Exp $
// Author: Fons Rademakers 19/02/98
//////////////////////////////////////////////////////////////////////////
......@@ -162,7 +162,8 @@ static void SetDisplay()
STRUCT_UTMP *utmp_entry = SearchEntry(ReadUtmp(), tty);
if (utmp_entry) {
static char display[64];
if (utmp_entry->ut_host[0]) {
if (utmp_entry->ut_host[0] &&
!utmp_entry->ut_host[sizeof(utmp_entry->ut_host)-1]) {
if (strchr(utmp_entry->ut_host, ':')) {
sprintf(display, "DISPLAY=%s", utmp_entry->ut_host);
fprintf(stderr, "*** DISPLAY not set, setting it to %s\n",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment