Use libc's built-in getutXXX() functions for manipulating the file. --- tcsh-6.13.00/tc.who.c.utmp 2004-08-17 17:19:44.541315488 +0200 +++ tcsh-6.13.00/tc.who.c 2004-08-17 17:22:12.251860072 +0200 @@ -165,12 +165,13 @@ watch_login(force) int force; { - int utmpfd, comp = -1, alldone; + int comp = -1, alldone; int firsttime = stlast == 1; #ifdef BSDSIGS sigmask_t omask; #endif /* BSDSIGS */ struct utmp utmp; + struct utmp *uptr; struct who *wp, *wpnew; struct varent *v; Char **vp = NULL; @@ -263,18 +264,8 @@ return; } stlast = sta.st_mtime; - if ((utmpfd = open(_PATH_UTMP, O_RDONLY|O_LARGEFILE)) < 0) { - if (!force) - xprintf(CGETS(26, 2, - "%s cannot be opened. Please \"unset watch\".\n"), - _PATH_UTMP); -# ifdef BSDSIGS - (void) sigsetmask(omask); -# else - (void) sigrelse(SIGINT); -# endif - return; - } + utmpname(_PATH_UTMP); + setutent(); /* * xterm clears the entire utmp entry - mark everyone on the status list @@ -289,7 +280,8 @@ * Read in the utmp file, sort the entries, and update existing entries or * add new entries to the status list. */ - while (read(utmpfd, (char *) &utmp, sizeof utmp) == sizeof utmp) { + while ((uptr = getutent())) { + memcpy(&utmp, uptr, sizeof(utmp)); # ifdef DEAD_PROCESS # ifndef IRIS4D @@ -385,7 +377,7 @@ wp->who_prev = wpnew; /* linked in now */ } } - (void) close(utmpfd); + endutent(); # if defined(UTHOST) && defined(_SEQUENT_) endutent(); # endif